Math-Arc by three points

From Vectorlab
Jump to: navigation, search


Given three points, returns the radius, start angle and sweep needed to build an arc passing through them. By Orso B. Schmid


{ Orso ***************************** }
{ given 3 vectors, draws an arc passing throught the 3 points }
PROCEDURE M_ArcBy3Points(p1, p2, p3: VECTOR; VAR arcCen: VECTOR; VAR radius, startAng, sweep : REAL);
	BEGIN
		arcCen := ThreePtCenter(p1, p2, p3); { Center }
		radius := Norm(p1 - arcCen);
		startAng := Vec2Ang(p1 - arcCen);
		sweep := Vec2Ang(p3 - arcCen) - startAng;
		{
		ArcByCenter(
			arcCen.x, arcCen.y, 
			radius, 
			startAng, sweep);
		}
	END;