void PerpendicularBisectorFromLine(VtPoint p, VtPoint q, ref float a, ref float b, ref float c) { VtPoint mid_point = new VtPoint((p.X + q.X) / 2f, (p.Y + q.Y) / 2f); c = -b * (mid_point.X) + a * (mid_point.Y);// c = -bx + ay float temp = a; a = -b; b = temp; }
public VtTriangle(VtPoint pointA, VtPoint pointB, VtPoint pointC) { A = pointA; B = pointB; C = pointC; AB = new VtEdge(A, B); AC = new VtEdge(A, C); BC = new VtEdge(B, C); CalcCircumCenter(); }
public void CalcCircumCenter() { float a, b, c; LineFromPoints(A, B, out a, out b, out c); float e, f, g; LineFromPoints(B, C, out e, out f, out g); PerpendicularBisectorFromLine(A, B, ref a, ref b, ref c); PerpendicularBisectorFromLine(B, C, ref e, ref f, ref g); CirC = lineLineIntersection(a, b, c, e, f, g); CirR = EMath.Len(A, CirC); }
void LineFromPoints(VtPoint p, VtPoint q, out float a, out float b, out float c) { a = q.Y - p.Y; b = p.X - q.X; c = a * (p.X) + b * (p.Y); }
public VtEdge(VPoint start, VPoint end) { S = new VtPoint(start); E = new VtPoint(end); M = (S + E) / 2; }
public VtEdge(VtPoint s, VtPoint e) { S = s; E = e; M = (s + e) / 2; }