Math-Line Line Intersection using vectors

From Vectorlab
Jump to: navigation, search


The same as the built-in routine LineLineIntersection, but using vectors. You need to load the routine M_Point2Vec before this. By Orso B. Schmid


{ Orso ************************************************ }
{ LineLineIntersection using vectors, drops all other infos }
FUNCTION M_LineLineIntersectVec(line1Strt, line1End, line2Strt, line2End: VECTOR): VECTOR;
	VAR
		parallel, intOnLines: BOOLEAN;
		p : POINT;
	BEGIN
		LineLineIntersection(
			M_Vec2Point(line1Strt), 
			M_Vec2Point(line1End), 
			M_Vec2Point(line2Strt), 
			M_Vec2Point(line2End), 
			parallel, intOnLines, p);
		M_LineLineIntersectVec := M_Point2Vec(p);
	END;