Class: Plane

Sylvester version: 0.1.0 onwards

Class methods: create, XY, XZ, YX, YZ, ZX, ZY

Instance methods: contains, distanceFrom, dup, eql, intersectionWith, intersects, isParallelTo, isPerpendicularTo, pointClosestTo, reflectionIn, rotate, setVectors, translate

Instance variables:

  • anchor – a 3D Vector corresponding to a point in the plane
  • normal – a normalized 3D Vector perpendicular to the plane


The Plane class is designed to model infinite flat planes in 3 dimensions.

Class methods

Plane.create(anchor, v1 [, v2]) 0.1.0

Creates a new Plane instance with the given properties. If two arguments are supplied, v1 should be the normal to the plane. If three arguments, v1 and v2 should be directions of vectors in the plane, such that the normal is v1 × v2. The instance will not store these directions, only the calculated normal. anchor is any point in the plane, and the normal vector is normalized before being saved.

Plane.XY, Plane.XZ, Plane.YX, Plane.YZ, Plane.ZX, Plane.ZY 0.1.0

Predefined Plane instances representing the x-y, y-z and z-x planes.

Instance methods

contains(obj) 0.1.0

Returns true iff obj is a Line or a Vector that lies in the receiver.

distanceFrom(obj) 0.1.0

Returns the shortest distance between the receiver and obj, which can be a Line, a Plane or a Vector.

dup() 0.1.0

Returns a copy of the receiver.

eql(plane) 0.1.0

Returns true iff plane and the receiver represent the same region of space. Their anchor and normal properties need not be identical for this to be the case. As long as plane.anchor is a point in the receiver, and plane.normal is (anti)parallel to the receiver’s normal, then this method returns true.

intersectionWith(obj) 0.1.0

Returns the unique intersection of the receiver with obj, which can be either a Line or a Plane. If obj is a Line, a Vector is returned. If obj is a Plane, a Line is returned. If no intersection exists, returns null.

intersects(obj) 0.1.0

Returns true iff the receiver has a unique intersection with obj, which can be either a Line or a Plane.

isParallelTo(obj) 0.1.0

Returns true iff the receiver and obj are parallel. If obj is a plane, their normal vectors can point in opposite directions – two planes with opposing normals represent the same set of points. If obj is a Line then its direction must be perpendicular to the receiver’s normal.

isPerpendicularTo(plane) 0.1.1

Returns true iff plane is perpendicular to the receiver.

pointClosestTo(point) 0.1.0

Returns a Vector representing the point on the receiver that is closest to the vector point.

reflectionIn(obj) 0.1.0

Returns a Plane representing the result of reflecting (inverting) the receiver in obj, which can be a Line, a Plane or a Vector.

rotate(angle, axis) 0.1.0

Returns the result of rotating the receiver by angle radians about the Line axis. The rotation is performed in a right-handed fashion about axis.direction.

setVectors(anchor, v1 [, v2]) 0.1.0

Sets the receiver’s properties accordingly. See create.

translate(vector) 0.1.0

Returns the result of translating the receiver by adding vector to its anchor property. vector can be a 2- or 3- dimensional array or Vector. If 2-dimensional, a zero third component will be added.