clipConvexPolygonInPlace MethodStatic

Clip a polygon to one side of a plane in place.

  • 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).
  • Output may also consist entirely of (colinear) polygon vertices that lie on the clip plane. No attempt is made to filter such zero-area output.
  • Other than ensuring capacity in the arrays, there are no object allocations during execution of this function.

clipConvexPolygonInPlace(plane: PlaneAltitudeEvaluator, xyz: IndexedReadWriteXYZCollection, work?: IndexedReadWriteXYZCollection, keepPositive: boolean = true, tolerance: number = Geometry.smallMetricDistance): number

@returns the number of on-plane vertices and maximal vertex intervals. If this is larger than 2, the input polygon was non-convex.

@see splitConvexPolygonInsideOutsidePlane for a method that clips to both sides of the plane.

Parameter Type Description
plane PlaneAltitudeEvaluator altitude evaluator
xyz IndexedReadWriteXYZCollection input polygon, clipped on output. Closure point, if present on input, is removed on output. Fewer than 3 input vertices results in empty output.
work IndexedReadWriteXYZCollection 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 on-plane vertices and maximal vertex intervals. If this is larger than 2, the input polygon was non-convex.

Defined in

Last Updated: 16 December, 2025