# 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.

Argument Type Required Description
`x` Vector3 Yes
`origin` Vector3 Yes The coordinate of the origin point.
`normal` Vector3 Yes

### distanceToPlane

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

Argument Type Required Description
`x` Vector3 Yes The point coordiante.

### evaluate

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

Argument Type Required Description
`normal` Vector3 Yes
`origin` Vector3 Yes The coordinate of the origin point.
`x` Vector3 Yes

### evaluateFunction

Evaluate plane equation for point x.

Accepts both an array point representation and individual xyz arguments.

Argument Type Required Description
`value` Vector3 Yes

### evaluateFunction

Evaluate plane equation for point x.

Accepts both an array point representation and individual xyz arguments.

Argument Type Required Description
`x` Number Yes The x coordinate.
`y` Number Yes The y coordinate.
`z` Number Yes The z coordinate.

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.

Argument Type Required Description
`xyz` Yes

### extend

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

Argument Type Required Description
`publicAPI` Yes object on which methods will be bounds (public)
`model` Yes object on which data structure will be bounds (protected)
`initialValues` IPlaneInitialValues No (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.

Argument Type Required Description
`x` Vector3 Yes
`origin` Vector3 Yes The coordinate of the origin point.
`normal` Vector3 Yes
`xproj` Vector3 Yes

### generalizedProjectPoint

Argument Type Required Description
`x` Vector3 Yes The point coordinate.
`xproj` Vector3 Yes The 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:

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.

Argument Type Required Description
`p1` Vector3 Yes
`p2` Vector3 Yes
`origin` Vector3 Yes The coordinate of the origin point.
`normal` Vector3 Yes

### 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:

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.

Argument Type Required Description
`p1` Vector3 Yes The first point coordiante.
`p2` Vector3 Yes The 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:

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`).
Argument Type Required Description
`plane1Origin` Vector3 Yes
`plane1Normal` Vector3 Yes
`plane2Origin` Vector3 Yes
`plane2Normal` Vector3 Yes

### 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:

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`).
Argument Type Required Description
`planeOrigin` Vector3 Yes
`planeNormal` Vector3 Yes

### newInstance

Method used to create a new instance of vtkPlane.

Argument Type Required Description
`initialValues` IPlaneInitialValues No for 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.

Argument Type Required Description
`x` Vector3 Yes
`origin` Vector3 Yes The coordinate of the origin point.
`normal` Vector3 Yes
`xproj` Vector3 Yes

### projectPoint

Argument Type Required Description
`x` Vector3 Yes The point coordinate.
`xproj` Vector3 Yes The projection point’s coordinate.

### projectVector

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

Argument Type Required Description
`v` Vector3 Yes The vector coordinate.
`normal` Vector3 Yes
`vproj` Vector3 Yes The projection vector’s coordinate..

### projectVector

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

Argument Type Required Description
`v` Vector3 Yes The vector coordinate.
`vproj` Vector3 Yes The 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.

Argument Type Required Description
`distance` Number Yes

### setNormal

Set the normal of the plane.

Argument Type Required Description
`x` Number Yes The x coordinate.
`y` Number Yes The y coordinate.
`z` Number Yes The z coordinate.

### setNormal

Set the normal of the plane.

Argument Type Required Description
`normal` Vector3 Yes The normal coordinate.

### setNormalFrom

Set the normal object.

Argument Type Required Description
`normal` Vector3 Yes The normal coordinate.

### setOrigin

Set the origin of the plane.

Argument Type Required Description
`x` Number Yes The x coordinate of the origin point.
`y` Number Yes The y coordinate of the origin point.
`z` Number Yes The z coordinate of the origin point.

### setOrigin

Set the origin of the plane.

Argument Type Required Description
`origin` Vector3 Yes The coordinate of the origin point.

### setOriginFrom

Set the origin of the plane.

Argument Type Required Description
`origin` Vector3 Yes The coordinate of the origin point.