/// <summary> /// Determines whether u is in the circumcircle of a, b, and c. /// </summary> public static Containment CircumcircleTest(VecRat2 a, VecRat2 b, VecRat2 c, VecRat2 d) { Turn t = TurnTestDiscrete(a, b, c); if (t == Turn.Right) { VecRat2 temp = b; b = c; c = temp; } else if (t == Turn.Linear) { throw new Exception("Can't do circumcircle test with a,b,c colinear."); } Rational ld = d.LengthSquared(); Rational r = Det3( a.X - d.X, a.Y - d.Y, a.LengthSquared() - ld, b.X - d.X, b.Y - d.Y, b.LengthSquared() - ld, c.X - d.X, c.Y - d.Y, c.LengthSquared() - ld); if (r > 0) { return(Containment.Inside); } else if (r == 0) { return(Containment.Boundary); } else { return(Containment.Outside); } }
public LineProjectionTransform(SegRat2 s) { this.anchor = s.A; this.dir = s.AB(); this.dot_anchor = dir * anchor; this.inv_dir_len_sq = 1 / dir.LengthSquared(); }