clipConvexPolygonInPlace MethodStatic

Clip a polygon to one side of a plane.

  • Results with 2 or fewer points are ignored.
  • Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.
  • For a convex input polygon, the output polygon is also convex.
  • For non-convex input, the output polygon may have double-back edges along plane intersections. This is still a valid clip in a parity sense (overlapping regions cancel).
  • This method returns only the piece of the input polygon on one side of the clipper. See splitConvexPolygonInsideOutsidePlane for a method that returns both sides.

clipConvexPolygonInPlace(plane: PlaneAltitudeEvaluator, xyz: GrowableXYZArray, work?: GrowableXYZArray, keepPositive: booleantrue, tolerance: numberGeometry.smallMetricDistance): number

@returns the number of crossings. If this is larger than 2, the input polygon was non-convex.

@see splitConvexPolygonInsideOutsidePlane

Parameter Type Description
plane PlaneAltitudeEvaluator any type that has plane.altitude
xyz GrowableXYZArray input polygon, clipped on output
work GrowableXYZArray optional work buffer
keepPositive boolean whether the positive side of the plane survives (true, default), or negative side (false).
tolerance number tolerance for "on plane" decision. This is a distance if plane has unit normal (e.g., ClipPlane).
Default value is smallMetricDistance.

Returns - number

the number of crossings. If this is larger than 2, the input polygon was non-convex.

Defined in

Last Updated: 09 October, 2025