/// <summary> /// TODO summary. /// </summary> public static __tpolygon__ ConvexClipped( this __tpolygon__ polygon, __tbox__ box, double eps = 1e-8) { var __plane__s = new[] { //# Meta.VecFields.Take(d).ForEach(axis => { new __tplane__(__tvec__.__axis__Axis, box.Min), new __tplane__(-__tvec__.__axis__Axis, box.Max), //# }); }; return(polygon.ConvexClipped(__plane__s)); }
/// <summary> /// Returns the convex polygon clipped by the set of __plane__s (defined /// as __tplane__s), i.e. all parts of the polygon that are at the positive /// side of the __plane__s. /// </summary> public static __tpolygon__ ConvexClipped( this __tpolygon__ polygon, __tplane__[] __plane__s, double eps = 1e-8) { foreach (var c in __plane__s) { polygon = polygon.ConvexClipped(c, eps); if (polygon.PointCount == 0) { break; } } return(polygon); }
/// <summary> /// Returns the polygon clipped by the hull, i.e. all parts of the /// polygon that are at the positive side of the hull __plane__s. /// </summary> public static __tpolygon__ ConvexClipped( this __tpolygon__ polygon, __thull__ hull, double eps = 1e-8) { return(polygon.ConvexClipped(hull.PlaneArray, eps)); }