protected bool EqualVertices(Vector2 v1, Vector2 v2, int precision = 3) { Vector2 a1 = Hedra.Truncate(v1, precision); Vector2 a2 = Hedra.Truncate(v2, precision); Vector2 difference = a1 - a2; return(difference.magnitude < EPSILON); }
/// <summary> /// Returns true if the point is contained in this segment. /// </summary> /// <param name="point"></param> /// <returns></returns> public override bool Contains(Vector2 point) { if (point == PointA || point == PointB) { return(true); } float value = Vector2.Distance(PointA, point) + Vector2.Distance(point, PointB) - Vector2.Distance(PointA, PointB); value = Hedra.Truncate(value, 3); return(-EPSILON <= value && value <= EPSILON); }