Skip to content

Class: ClipPlane ​

Defined in: utils/ClipPlane.ts:57

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 ​

typescript
// 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 ​

ts
new ClipPlane(config?): ClipPlane;

Defined in: utils/ClipPlane.ts:73

Parameters ​

config? ​

ClipPlaneConfig = {}

Returns ​

ClipPlane

Properties ​

normal ​

ts
normal: Vector3;

Defined in: utils/ClipPlane.ts:59

Plane normal (unit vector pointing toward kept region)


point ​

ts
point: Vector3;

Defined in: utils/ClipPlane.ts:62

A point on the plane


enabled ​

ts
enabled: boolean;

Defined in: utils/ClipPlane.ts:65

Whether this clip plane is active

Methods ​

setFromAxisDistance() ​

ts
setFromAxisDistance(
   axis, 
   distance, 
   flip?
): this;

Defined in: utils/ClipPlane.ts:89

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() ​

ts
setFromPoints(
   a, 
   b, 
   c
): this;

Defined in: utils/ClipPlane.ts:127

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() ​

ts
setFromNormalAndPoint(normal, point): this;

Defined in: utils/ClipPlane.ts:154

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() ​

ts
setDistance(distance): this;

Defined in: utils/ClipPlane.ts:174

Set the distance along the current normal direction. Useful for slider-based interaction.

Parameters ​

distance ​

number

Distance from origin along normal

Returns ​

this


getDistance() ​

ts
getDistance(): number;

Defined in: utils/ClipPlane.ts:185

Get the current distance from origin.

Returns ​

number


setEnabled() ​

ts
setEnabled(enabled): this;

Defined in: utils/ClipPlane.ts:192

Enable or disable the clip plane.

Parameters ​

enabled ​

boolean

Returns ​

this


toggle() ​

ts
toggle(): this;

Defined in: utils/ClipPlane.ts:200

Toggle the enabled state.

Returns ​

this


flip() ​

ts
flip(): this;

Defined in: utils/ClipPlane.ts:208

Flip the clipping direction (swap which side is kept/clipped).

Returns ​

this


getThreePlane() ​

ts
getThreePlane(): Plane;

Defined in: utils/ClipPlane.ts:218

Get the Three.js Plane object for use with material clipping.

Returns ​

Plane


getShaderUniforms() ​

ts
getShaderUniforms(): object;

Defined in: utils/ClipPlane.ts:225

Get shader uniform values for GPU clipping.

Returns ​

object

normal ​
ts
normal: Vector3;
point ​
ts
point: Vector3;
enabled ​
ts
enabled: boolean;

toStateJSON() ​

ts
toStateJSON(): object;

Defined in: utils/ClipPlane.ts:233

Returns ​

object

axis ​
ts
axis: string;
normal ​
ts
normal: [number, number, number];
distance ​
ts
distance: number;
enabled ​
ts
enabled: boolean;
flip ​
ts
flip: boolean;

clone() ​

ts
clone(): ClipPlane;

Defined in: utils/ClipPlane.ts:252

Clone this clip plane.

Returns ​

ClipPlane

Released under the MIT License.