Search:
Class Plane
class
Plane
The Plane class provides a very useful definition of a plane. A Plane object consists solely of a base point and a normal vector, thus implicitly representing the infinitude of a plane.
Defined in
Plane.js
Variable Summary
The "base" point of the plane.
The normal vector of the plane, which wholly defines the Plane along with the base point.
Constructor Summary
The constructor function for a new Plane.
Function Summary
Gets the distance of a plane, line or point from the plane.
Gets the intersection of a plane with a given Line or Plane.
Tests to see if a line or plane intersects with this plane.
Tests to see if the plane is parallel to a given Plane or Line.
Tests to see if two planes are perpendicular to each other.
Finds the point in the plane closest to the given point.
Rotates a plane through deg degrees about an arbitrary line.
Returns a string representation of the Plane.
Variable Details
variable public static Plane XY
The XY-plane. Base = (0,0,0), Direction = Vector.k
variable public static Plane XZ
Same as Plane.ZX
See also:
variable public static Plane YX
Same as Plane.XY
See also:
variable public static Plane YZ
The YZ-plane. Base = (0,0,0), Direction = Vector.i
variable public static Plane ZX
The ZX-plane. Base = (0,0,0), Direction = Vector.j
variable public static Plane ZY
Same as Plane.YZ
See also:
variable private mathnetics.point3D base
The "base" point of the plane.
variable private mathnetics.point3D norm
The normal vector of the plane, which wholly defines the Plane along with the base point.
Constructor Details
constructor Plane
Plane(Plane
plane)
Plane(mathnetics.point3D
base, mathnetics.point3D
norm)
Plane(mathnetics.point3D
base, mathnetics.point3D
v1, mathnetics.point3D
v2)
The constructor function for a new Plane.
Parameters:
Clone
plane
- the Plane object to duplicate Normal
base
- the base point of the plane; if a Plane object, will create a duplicate of the plane
norm
- (can also be a 3D Vector) the normal vector if only one vector is supplied Two Vectors
base
- the base point of the plane; if a Plane object, will create a duplicate of the plane
v1
- (can also be a 3D Vector) one of two vectors that determines the normal
v2
- (can also be a 3D Vector) from two vectors, the normal becomes (v1 cross v2) Function Details
function distanceFrom
public
Number
distanceFrom(mathnetics.point3D
point)
public
Number
distanceFrom(Line
line)
public
Number
distanceFrom(Plane
plane)
Gets the distance of a plane, line or point from the plane.
Parameters:
fromPoint
point
- the point to find the distance from this plane fromLine
line
- the line to find the distance from this plane fromPlane
plane
- the plane to find the distance from this plane
Returns:
the distance between the plane and obj
function equalTo
public
boolean
equalTo(Plane
plane)
Tests whether two planes are equal.
Parameters:
plane
- the plane to test for equality
Returns:
true if planes are equal, false otherwise
function intersection
public
Object
intersection(Line
line)
public
Object
intersection(Plane
plane)
Gets the intersection of a plane with a given Line or Plane.
Parameters:
Line
line
- the line with which to find the intersection Plane
plane
- the plane with which to find the intersection
Returns:
the intersection of this and obj: mathnetics.point3D (aka Vector) if obj is a Line, a Line if obj is a Plane
function intersects
public
boolean
intersects(Line
line)
public
boolean
intersects(Plane
plane)
Tests to see if a line or plane intersects with this plane.
Parameters:
Line
line
- the line to test Plane
plane
- the plane to test
Returns:
true iff an intersection exists, false otherwise
function isParallel
public
boolean
isParallel(Plane
plane)
public
boolean
isParallel(Line
line)
Tests to see if the plane is parallel to a given Plane or Line.
Parameters:
toPlane
plane
- the plane to check to see if parallel toLine
line
- the line to check to see if parallel
Returns:
true if parallel, false otherwise
function isPerpendicular
public
boolean
isPerpendicular()
Tests to see if two planes are perpendicular to each other.
Returns:
true iff planes are perpendicular, false otherwise
function pointClosestTo
public
mathnetics.point3D
pointClosestTo(mathnetics.point3D
point)
Finds the point in the plane closest to the given point.
Parameters:
point
- (can also be a 3D Vector) the point to which to find the closest point in the plane
Returns:
mathnetics.point3D or Vector (depending on type of point above) that is the closest point on the plane to point
function rotate
Rotates a plane through deg degrees about an arbitrary line.
Parameters:
deg
- the number of degrees (in radians) to rotate the plane
line
- the Line about which to rotate the plane
Returns:
a new Plane that is the old rotated deg about line
function toString
public
String
toString()
Returns a string representation of the Plane.
Returns:
the string version of the plane
function translate
public
Plane
translate(Number
dx, Number
dy, Number
dz)
Translates a plane by dx, dy and dz (normal does not change, only the base)
Parameters:
dx
- the x translation
dy
- the y translation
dz
- the z translation
Returns:
the translated plane as a new Plane object