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

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

ArgumentTypeRequiredDescription
xVector3Yes
originVector3YesThe coordinate of the origin point.
normalVector3Yes

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.

evaluate

Quick evaluation of plane equation n(x-origin) = 0.

ArgumentTypeRequiredDescription
normalVector3Yes
originVector3YesThe coordinate of the origin point.
xVector3Yes

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

Project a point x onto plane defined by origin and normal. The projected point is returned in xproj.

!!! note normal does NOT have to have magnitude 1.

ArgumentTypeRequiredDescription
xVector3Yes
originVector3YesThe coordinate of the origin point.
normalVector3Yes
xprojVector3Yes

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
p1Vector3Yes
p2Vector3Yes
originVector3YesThe coordinate of the origin point.
normalVector3Yes

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
plane1OriginVector3Yes
plane1NormalVector3Yes
plane2OriginVector3Yes
plane2NormalVector3Yes

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

Project a point x onto plane defined by origin and normal. The projected point is returned in xproj. !!! note normal assumed to have magnitude 1.

ArgumentTypeRequiredDescription
xVector3Yes
originVector3YesThe coordinate of the origin point.
normalVector3Yes
xprojVector3Yes

projectPoint

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

projectVector

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

ArgumentTypeRequiredDescription
vVector3YesThe vector coordinate.
normalVector3Yes
vprojVector3YesThe projection vector'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.