#ifndef LINE_INT_H
# define LINE_INT_H

# ifndef GPK_STD_H
#  include <gpk_std.h>
# endif
# ifndef V2_H
#  include "v2.h"
# endif
# ifndef LINE_H
#  include "line.h"
# endif
# ifndef NLINE_H
#  include "nline.h"
# endif



class line_intersection {
	TBOOL alongline, atinf, not_ready;
	int n_int;
	line where;
	double direction;
	vector2 ii[2];
	double _sa[2], _sb[2];

	public:
	line_intersection();
	line_intersection(C line_intersection& a);
	line_intersection(C line& a, C line& b);
	line_intersection(C nline& a, C line& b);
	line_intersection(C line& a, C nline& b);
	line_intersection& operator=(C line_intersection& a);

	C vector2& operator[](int i) C {return ii[i];}
	C double& sa(int i) C	{return _sa[i];}
	C double& sb(int i) C	{return _sb[i];}
	double inf_angle() C	{return direction;}	/* Valid iff at_inf(). */
	C line& l() C		{return where;}		/* Valid iff line_int(). */

	int num_ints() C	{return n_int;}
	BOOL one_int() C	{return n_int==1;}
	BOOL at_inf() C		{return atinf;}
	BOOL no_int() C		{return n_int==0;}
	BOOL line_int() C	{return alongline;}
	BOOL non_null()	C	{return n_int!=0;}
	BOOL operator!() C	{return not_ready;}

	BOOL invariant() C;
	};

#endif
