Skip to content

Plane ​

Introduction ​

vtkPlane provides methods for various plane computations. These include projecting points onto a plane, evaluating the plane equation, and returning plane normal.

Methods ​

distanceToPlane ​

Get the distance of a point x to a plane defined by n (x-p0) = 0. The normal n must be magnitude = 1.

ArgumentTypeRequiredDescription
xVector3YesThe point coordiante.

evaluateFunction ​

Evaluate plane equation for point x.

Accepts both an array point representation and individual xyz arguments.

js
plane.evaluateFunction([0.0, 0.0, 0.0]);
plane.evaluateFunction(0.0, 0.0, 0.0);
ArgumentTypeRequiredDescription
valueVector3Yes

evaluateFunction ​

Evaluate plane equation for point x.

Accepts both an array point representation and individual xyz arguments.

js
plane.evaluateFunction([0.0, 0.0, 0.0]);
plane.evaluateFunction(0.0, 0.0, 0.0);
ArgumentTypeRequiredDescription
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.

evaluateGradient ​

Given the point xyz (three floating values) evaluate the equation for the plane gradient. Note that the normal and origin must have already been specified. The method returns an array of three floats.

ArgumentTypeRequiredDescription
xyzYes

extend ​

Method used to decorate a given object (publicAPI+model) with vtkPlane characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIPlaneInitialValuesNo(default: {})

generalizedProjectPoint ​

ArgumentTypeRequiredDescription
xVector3YesThe point coordinate.
xprojVector3YesThe projection point's coordinate.

getNormal ​

Get plane normal. Plane is defined by point and normal.

getNormalByReference ​

Get plane normal. Plane is defined by point and normal.

getOrigin ​

Get the origin of the plane

getOriginByReference ​

Get the origin of the plane

intersectWithLine ​

Given a line defined by the two points p1,p2; and a plane defined by the normal n and point p0, compute an intersection. Return an object:

js
let obj = {intersection: ..., betweenPoints: ..., t: ..., x: ...};

where:

  • intersection (boolean): indicates if the plane and line intersect.
  • betweenPoints (boolean): indicates if the intersection is between the provided points. True if (0 <= t <= 1), and false otherwise.
  • t (Number): parametric coordinate along the line.
  • x (Array): coordinates of intersection.

If the plane and line are parallel, intersection is false and t is set to Number.MAX_VALUE.

ArgumentTypeRequiredDescription
p1Vector3YesThe first point coordiante.
p2Vector3YesThe second point coordiante.

intersectWithPlane ​

Given a planes defined by the normals n0 & n1 and origin points p0 & p1, compute the line representing the plane intersection. Return an object:

js
let obj = {intersection: ..., error: ..., l0: ..., l1: ...};

where:

  • intersection (boolean): indicates if the two planes intersect. Intersection is true if (0 <= t <= 1), and false otherwise.
  • l0 (Array): coordinates of point 0 of the intersection line.
  • l1 (Array): coordinates of point 1 of the intersection line.
  • error (String|null): Conditional, if the planes do not intersect, is it because they are coplanar (COINCIDE) or parallel (DISJOINT).
ArgumentTypeRequiredDescription
planeOriginVector3Yes
planeNormalVector3Yes

newInstance ​

Method used to create a new instance of vtkPlane.

ArgumentTypeRequiredDescription
initialValuesIPlaneInitialValuesNofor pre-setting some of its content

projectPoint ​

ArgumentTypeRequiredDescription
xVector3YesThe point coordinate.
xprojVector3YesThe projection point's coordinate.

projectVector ​

Project a vector v onto plane. The projected vector is returned in vproj.

ArgumentTypeRequiredDescription
vVector3YesThe vector coordinate.
vprojVector3YesThe projection vector's coordinate..

push ​

Translate the plane in the direction of the normal by the distance specified. Negative values move the plane in the opposite direction.

ArgumentTypeRequiredDescription
distanceNumberYes

setNormal ​

Set the normal of the plane.

ArgumentTypeRequiredDescription
xNumberYesThe x coordinate.
yNumberYesThe y coordinate.
zNumberYesThe z coordinate.

setNormal ​

Set the normal of the plane.

ArgumentTypeRequiredDescription
normalVector3YesThe normal coordinate.

setNormalFrom ​

Set the normal object.

ArgumentTypeRequiredDescription
normalVector3YesThe normal coordinate.

setOrigin ​

Set the origin of the plane.

ArgumentTypeRequiredDescription
xNumberYesThe x coordinate of the origin point.
yNumberYesThe y coordinate of the origin point.
zNumberYesThe z coordinate of the origin point.

setOrigin ​

Set the origin of the plane.

ArgumentTypeRequiredDescription
originVector3YesThe coordinate of the origin point.

setOriginFrom ​

Set the origin of the plane.

ArgumentTypeRequiredDescription
originVector3YesThe coordinate of the origin point.

x ​

The intersection point, or an empty array when the line is parallel to the plane and no intersection was computed.