ClipPrimitive Class

  • ClipPrimitive is a base class for clipping implementations that use
    • A UnionOfConvexClipPlaneSets designated "clipPlanes"
    • an "invisible" flag
  • When constructed directly, objects of type ClipPrimitive (directly, not through a derived class) will have just planes
  • Derived classes (e.g. ClipShape) carry additional data such as a swept shape.
  • ClipPrimitive can be constructed with no planes.
    • Derived class is responsible for filling the plane sets.
    • At discretion of derived classes, plane construction can be done at construction time or "on demand when" queries call ensurePlaneSets ()
  • ClipPrimitive can be constructed directly with planes (and no derived class).
  • That the prevailing use is via a ClipShape derived class.
    • The ClipShape has an "isMask" property
      • isMask === false means the plane sets should cover the inside of its polygon
      • isMask === true means the plane sets should cover the outside of its polygon.
  • Note that the ClipShape's isMask property and the ClipPrimitive's isInvisible property are distinct controls.
    • In normal usage, callers get "outside" clip behavior using ONLY the ClipShape isMask property.
    • The ClipShape happens to pass the _invisible bit down to ClipPlanes that it creates.
      • At that level, the flag controls whether the cut edges are produced on the plane
      • This seems like an confused overloading of the meaning.

Extended by

Implements

Methods

Name Description
constructor(planeSet?: UnionOfConvexClipPlaneSets, isInvisible: boolean = false): ClipPrimitive Protected    
announceClippedArcIntervals(arc: Arc3d, announce?: AnnounceNumberNumberCurvePrimitive): boolean Method from Clipper interface.  
announceClippedSegmentIntervals(f0: number, f1: number, pointA: Point3d, pointB: Point3d, announce?: AnnounceNumberNumber): boolean Method from Clipper interface.  
arePlanesDefined(): boolean Returns true if the planes are present.  
classifyPointContainment(points: Point3d[], ignoreInvisibleSetting: boolean): ClipPlaneContainment Quick test of whether the given points fall completely inside or outside.  
clone(): ClipPrimitive Return a deep clone  
containsZClip(): boolean Return true if any plane of the primary clipPlanes has (a) non-zero z component in its normal vector and (b) finite distance from origin.  
ensurePlaneSets(): void * trigger (if needed) computation of plane sets (if applicable) in the derived class.  
fetchClipPlanesRef(): undefined | UnionOfConvexClipPlaneSets Get a reference to the UnionOfConvexClipPlaneSets.  
isPointOnOrInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean Method from Clipper interface.  
multiplyPlanesByMatrix4d(matrix: Matrix4d, invert: boolean = true, transpose: boolean = true): boolean Multiply all ClipPlanes DPoint4d by matrix.  
pointInside(point: Point3d, onTolerance: number = Geometry.smallMetricDistanceSquared): boolean Return true if the point lies inside/on this polygon (or not inside/on if this polygon is a mask).  
setInvisible(invisible: boolean): void Sets both the clip plane set and the mask set visibility  
toJSON(): ClipPrimitiveProps Emit json form of the clip planes  
transformInPlace(transform: Transform): boolean Apply a transform to the clipper (e.g.  
createCapture(planes: undefined | ConvexClipPlaneSet | UnionOfConvexClipPlaneSets, isInvisible: boolean = false): ClipPrimitive Static Create a ClipPrimitive, capturing the supplied plane set as the clip planes.  
fromJSON(json: undefined | ClipPrimitiveProps): undefined | ClipPrimitive Static Promote json object form to class instance  
fromJSONClipPrimitive(json: undefined | ClipPrimitivePlanesProps): undefined | ClipPrimitive Static Specific converter producing the base class ClipPrimitive.  

Properties

Name Type Description
_clipPlanes Protected undefined | UnionOfConvexClipPlaneSets The (union of) convex regions.  
_invisible Protected boolean If true, pointInside inverts the sense of the pointInside for the _clipPlanes  
invisible Accessor ReadOnly boolean Ask if this primitive is a hole.  

Defined in

Last Updated: 20 June, 2023