Class: ClipPlane
Defined in: src/utils/ClipPlane.ts:40
ClipPlane manages a single clipping plane for surface visualization.
Clipping removes parts of the surface on one side of the plane, useful for revealing internal structures (e.g., medial wall) or focusing on specific regions.
Example
// Clip at x=0 (midline sagittal cut)
const clipX = new ClipPlane();
clipX.setFromAxisDistance('x', 0);
// Clip using three points
const clipCustom = new ClipPlane();
clipCustom.setFromPoints(p1, p2, p3);Constructors
Constructor
new ClipPlane(config?): ClipPlane;Defined in: src/utils/ClipPlane.ts:56
Parameters
config?
ClipPlaneConfig = {}
Returns
ClipPlane
Properties
normal
normal: Vector3;Defined in: src/utils/ClipPlane.ts:42
Plane normal (unit vector pointing toward kept region)
point
point: Vector3;Defined in: src/utils/ClipPlane.ts:45
A point on the plane
enabled
enabled: boolean;Defined in: src/utils/ClipPlane.ts:48
Whether this clip plane is active
Methods
setFromAxisDistance()
setFromAxisDistance(
axis,
distance,
flip?): this;Defined in: src/utils/ClipPlane.ts:72
Set clip plane from axis and distance from origin.
Parameters
axis
ClipAxis
Which axis the plane is perpendicular to ('x', 'y', or 'z')
distance
number
Distance from origin along the axis
flip?
boolean = false
If true, flip which side is clipped (default: false)
Returns
this
setFromPoints()
setFromPoints(
a,
b,
c): this;Defined in: src/utils/ClipPlane.ts:106
Set clip plane from three points. The plane normal is computed using the right-hand rule.
Parameters
a
Vector3
First point
b
Vector3
Second point
c
Vector3
Third point
Returns
this
setFromNormalAndPoint()
setFromNormalAndPoint(normal, point): this;Defined in: src/utils/ClipPlane.ts:131
Set clip plane from normal and point directly.
Parameters
normal
Vector3
Plane normal (will be normalized)
point
Vector3
Point on the plane
Returns
this
setDistance()
setDistance(distance): this;Defined in: src/utils/ClipPlane.ts:149
Set the distance along the current normal direction. Useful for slider-based interaction.
Parameters
distance
number
Distance from origin along normal
Returns
this
getDistance()
getDistance(): number;Defined in: src/utils/ClipPlane.ts:159
Get the current distance from origin.
Returns
number
setEnabled()
setEnabled(enabled): this;Defined in: src/utils/ClipPlane.ts:166
Enable or disable the clip plane.
Parameters
enabled
boolean
Returns
this
toggle()
toggle(): this;Defined in: src/utils/ClipPlane.ts:174
Toggle the enabled state.
Returns
this
flip()
flip(): this;Defined in: src/utils/ClipPlane.ts:182
Flip the clipping direction (swap which side is kept/clipped).
Returns
this
getThreePlane()
getThreePlane(): Plane;Defined in: src/utils/ClipPlane.ts:192
Get the Three.js Plane object for use with material clipping.
Returns
Plane
getShaderUniforms()
getShaderUniforms(): object;Defined in: src/utils/ClipPlane.ts:199
Get shader uniform values for GPU clipping.
Returns
object
normal
normal: Vector3;point
point: Vector3;enabled
enabled: boolean;toStateJSON()
toStateJSON(): object;Defined in: src/utils/ClipPlane.ts:207
Returns
object
axis
axis: string;normal
normal: [number, number, number];distance
distance: number;enabled
enabled: boolean;flip
flip: boolean;clone()
clone(): ClipPlane;Defined in: src/utils/ClipPlane.ts:226
Clone this clip plane.
Returns
ClipPlane