LCCObject::setClipPrism
Sets a polygonal prism clipping region.
Defines a prism volume by extruding a set of coplanar polygon vertices along the face normal direction using offsetMin / offsetMax, and clips the scene accordingly. Supports both convex and concave polygons; self-intersecting polygons are not supported.
Pass undefined or omit the parameter to clear the clipping.
Version Requirement
SDK v0.6.4+
Engine Support
Three.js
API
LCCObject::setClipPrism(param?: LccClipPrismParams): void
Parameters
LccClipPrismParams
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
vertices | IPoint3[] | Yes | - | Reference plane polygon vertices (world coordinates, coplanar, any winding order). Min 3, max 200. |
offsetMax | number | Yes | - | Upper offset along the face normal direction (can be negative, must be greater than offsetMin). |
offsetMin | number | Yes | - | Lower offset along the face normal direction (can be negative, must be less than offsetMax). |
normal | IPoint3 | Yes | - | Normal direction. |
clipSide | number | No | 1 | Clipping mode: 1 = keep interior (clip exterior), -1 = keep exterior (clip interior). |
IPoint3
interface IPoint3 {
x: number;
y: number;
z: number;
}
Return Value
void
Usage Example
// Set a rectangular prism clipping region (4 coplanar vertices)
lccObject.setClipPrism({
vertices: [
{ x: 0, y: 0, z: 0 },
{ x: 10, y: 0, z: 0 },
{ x: 10, y: 10, z: 0 },
{ x: 0, y: 10, z: 0 }
],
offsetMin: -5,
offsetMax: 5,
normal: { x: 0, y: 0, z: 1 },
clipSide: 1
});
// Inverse clipping: keep the exterior of the prism
lccObject.setClipPrism({
vertices: [
{ x: 0, y: 0, z: 0 },
{ x: 10, y: 0, z: 0 },
{ x: 10, y: 10, z: 0 },
{ x: 0, y: 10, z: 0 }
],
offsetMin: -5,
offsetMax: 5,
normal: { x: 0, y: 0, z: 1 },
clipSide: -1
});
// Clear clipping
lccObject.setClipPrism();
Notes
- Vertices must be coplanar (tolerance: 0.01 world coordinate units). Non-coplanar vertices will cause the call to fail with an error log.
- The vertex count must be between 3 and 200. Values outside this range will cause the call to fail.
offsetMaxmust be strictly greater thanoffsetMin; otherwise the call will fail.- Adjusting
offsetMin/offsetMax/clipSideis a lightweight operation and can be called at high frequency. - Modifying polygon vertices triggers an internal texture update, so frequent vertex updates are not recommended.
- Self-intersecting polygons are not supported; using them will produce unpredictable clipping results.
Related APIs
LCCObject::setClipBox()— Axis-aligned bounding box clippingLCCObject::setClipPlane()— Plane clipping