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.
  • plane is passed as unrolled Point4d (ax,ay,az,aw) point (x,y,z) acts as homogeneous (x,y,z,1)
    • keepPositive === true selects positive altitudes.

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

Parameter Type Description
plane PlaneAltitudeEvaluator any type that has plane.altitude
xyz GrowableXYZArray input points.
work GrowableXYZArray work buffer
keepPositive boolean  
tolerance number tolerance for "on plane" decision.

Returns - number

the number of crossings. If this is larger than 2, the result is "correct" in a parity sense but may have overlapping (hence cancelling) parts.

Defined in

Last Updated: 12 June, 2024