public override bool Equals(object obj) { if (obj is CGM.Scanner.Point) { PointF tf2 = (PointF)obj; if (Math2.IsNul(this.X - tf2.X)) { PointF tf = (PointF)obj; if (Math2.IsNul(this.Y - tf.Y)) { return(true); } } return(false); } if (!(obj is PointDbl)) { throw new InvalidCastException(); } PointDbl dbl2 = (PointDbl)obj; if (Math2.IsNul(this.X - dbl2.X)) { PointDbl dbl = (PointDbl)obj; if (Math2.IsNul(this.Y - dbl.Y)) { return(true); } } return(false); }
// Methods public static CircleInfo FindCircleBy3Points(PointDbl[] p) { CircleInfo info = new CircleInfo();//TODO if (Math2.IsNul(Math2.CompareAngles(p[0].X - p[1].X, p[0].Y - p[1].Y, p[2].X - p[1].X, p[2].Y - p[1].Y))) { info.R = -1.0; return(info); } double[] numArray = Math2.SolveSystem2(new double[, ] { { 2.0 * (p[0].X - p[2].X), 2.0 * (p[0].Y - p[2].Y) }, { 2.0 * (p[1].X - p[2].X), 2.0 * (p[1].Y - p[2].Y) } }, new double[] { (((p[0].X * p[0].X) - (p[2].X * p[2].X)) + (p[0].Y * p[0].Y)) - (p[2].Y * p[2].Y), (((p[1].X * p[1].X) - (p[2].X * p[2].X)) + (p[1].Y * p[1].Y)) - (p[2].Y * p[2].Y) }); info.Center.X = numArray[0]; info.Center.Y = numArray[1]; info.R = Math2.Distance(p[0].X - numArray[0], p[0].Y - numArray[1]); return(info); }