// Compute the circle defined by three points public void Circumcircle(Point p1, Point p2, Point p3) { float orientation; orientation = PointExtension.Cross(p1, p2, p3); if (orientation != 0.0) { float p1Sq, p2Sq, p3Sq; float num; float cx, cy; p1Sq = p1.x * p1.x + p1.y * p1.y; p2Sq = p2.x * p2.x + p2.y * p2.y; p3Sq = p3.x * p3.x + p3.y * p3.y; num = p1Sq * (p2.y - p3.y) + p2Sq * (p3.y - p1.y) + p3Sq * (p1.y - p2.y); cx = num / (2.0f * orientation); num = p1Sq * (p3.x - p2.x) + p2Sq * (p1.x - p3.x) + p3Sq * (p2.x - p1.x); cy = num / (2.0f * orientation); center.x = cx; center.y = cy; } radius = center.Distance(p1); }
public void ParsePoints() { Point[] points = PointExtension.ParsePoints("0,0 1,0"); Assert.AreEqual(2, points.Length); points = PointExtension.ParsePoints("0,0,0 1,0,0"); Assert.AreEqual(2, points.Length); }
public void getPointBelowTest() { Point p = new Point(1, 4); Point expected = new Point(1, 5); Point actual; actual = PointExtension.getPointBelow(p); Assert.AreEqual(expected, actual); }
public override int GetHashCode() { int hash = 1; if (BoundaryBuffer != 0D) { hash ^= BoundaryBuffer.GetHashCode(); } if (HighSpeedCentricAccelerationLimit != 0D) { hash ^= HighSpeedCentricAccelerationLimit.GetHashCode(); } if (LowSpeedCentricAccelerationLimit != 0D) { hash ^= LowSpeedCentricAccelerationLimit.GetHashCode(); } if (HighSpeedThreshold != 0D) { hash ^= HighSpeedThreshold.GetHashCode(); } if (LowSpeedThreshold != 0D) { hash ^= LowSpeedThreshold.GetHashCode(); } if (MinimalKappa != 0D) { hash ^= MinimalKappa.GetHashCode(); } if (PointExtension != 0D) { hash ^= PointExtension.GetHashCode(); } if (LowestSpeed != 0D) { hash ^= LowestSpeed.GetHashCode(); } if (NumPointsToAvgKappa != 0) { hash ^= NumPointsToAvgKappa.GetHashCode(); } if (StaticObsNudgeSpeedRatio != 0D) { hash ^= StaticObsNudgeSpeedRatio.GetHashCode(); } if (DynamicObsNudgeSpeedRatio != 0D) { hash ^= DynamicObsNudgeSpeedRatio.GetHashCode(); } if (CentriJerkSpeedCoeff != 0D) { hash ^= CentriJerkSpeedCoeff.GetHashCode(); } return(hash); }
void AddTriangle(Point p1, Point p2, Point p3) { triangles.Add(new Triangle(p1, p2, p3)); float orientation = PointExtension.Cross(p1, p2, p3); // Add indices in clockwise order if (orientation < 0) { indices.Add(p1.index); indices.Add(p2.index); indices.Add(p3.index); } else if (orientation > 0) { indices.Add(p3.index); indices.Add(p2.index); indices.Add(p1.index); } }