/// <summary> /// Return true if the supplied Elements.Geometry.Triangle has the same vertices as this Triangle. /// </summary> /// <param name="thatTriangle">Triangle to compare to this Triangle.</param> /// <returns> /// True if the Triangle vertex positions are AlmostEqual to those of the supplied Triangle. /// </returns> public static bool IsEqualTo(this Elements.Geometry.Triangle triangle, Elements.Geometry.Triangle thatTriangle) { var points = triangle.Points(); var thosePnts = thatTriangle.Points(); var common = 0; points.ForEach(p => common += p.Occurs(thosePnts)); if (common == 3) { return(true); } return(false); }
/// <summary> /// Returns the Triangle as a CCW Polygon. /// </summary> /// <returns></returns> public static Polygon ToPolygon(this Elements.Geometry.Triangle triangle) { var polygon = new Polygon(triangle.Points()); return(polygon.IsClockWise() ? polygon.Reversed() : polygon); }