|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Line
The Line class defines a new object type for a line. It is in a sense a "point-slope" definition of a line.
A Line has a base point and a direction, the direction being a unit vector.
This is an effective way of defining a line in a way that does not limit it to any specific segment and allows for Affine Transformations to be applied.
Defined in Line.js
Requires:
Field Summary | |
point3D |
base
The "anchor" point. |
point3D |
direction
The direction of the line; will be a unit vector. |
<static> Line |
x
The x-axis. |
<static> Line |
y
The y-axis. |
<static> Line |
z
The z-axis. |
Constructor Summary | |
Line(<Object> base, <Object> direction)
The constructor function for a new Line. |
Method Summary | |
Boolean
|
contains(point)
Tests to see if a point lies on the line. |
Number
|
distanceFrom(<Object> obj)
Gets the distance between a line and another line, plane, or a point. |
Boolean
|
equalTo(<Line> line)
Tests two lines for equality. |
point3D
|
intersection(<Object> obj)
Finds the UNIQUE intersection of a line and another Line or Plane. |
Boolean
|
intersects(<Object> obj)
Tests if this line intersects with a given line or plane. |
Boolean
|
isParallel(<Object> obj)
Tests to see if a line is parallel to another line or plane. |
Boolean
|
liesIn(<Plane> plane)
Tests if a Line lies in a given Plane. |
point3D
|
pointAt(<Number> t)
Returns the point on the line at a given value of t. |
point3D
|
pointClosestTo(<Object> obj)
Finds the point on this line closest to a given line or point. |
Line
|
reflectionIn(<Object> obj)
Returns the line's reflection in the given point, line, or plane. |
Line
|
rotate(<Number> deg, line)
Rotates a line through an angle about an arbitrary line. |
String
|
toString()
Returns a string representation of the Line. |
Line
|
translate(<Number> dx, <Number> dy, <Number> dz)
Returns a new Line that is the old one translated by dx, dy, and dz. |
Field Detail |
point3D base
point3D direction
<static> Line x
<static> Line y
<static> Line z
Constructor Detail |
Line(<Object> base, <Object> direction)
base
- the base point of the Line; can be a point2D, point3D or Vector (of dimension 2 or 3) object. The actual base point of the Line will be a point3D object. (If base is a Line object, creates a clone)
direction
- the direction of the Line; can be a point2D, point3D or Vector. Actual direction will be a normalized point3D object.
Method Detail |
Boolean contains(point)
the
- point to test
Number distanceFrom(<Object> obj)
obj
- either a Line, Plane, point2D or point3D, from which to find the distance to the line
Boolean equalTo(<Line> line)
line
- the line to compare
point3D intersection(<Object> obj)
obj
- the line or plane with which to find the intersection point
Boolean intersects(<Object> obj)
obj
- Line or Plane, to test for intersection with the line
Boolean isParallel(<Object> obj)
obj
- either a Line or a Plane, with which to test parallelity
Boolean liesIn(<Plane> plane)
plane
- the plane which may or may not contain this Line
point3D pointAt(<Number> t)
t
- the time value at which to find the point on the line
point3D pointClosestTo(<Object> obj)
obj
- a Line or point (or Vector)
Line reflectionIn(<Object> obj)
obj
- Plane, Line, or point2D/3D/Vector about which to reflect the line
Line rotate(<Number> deg, line)
deg
- the degrees, in radians, to rotate the line
the
- line about which to rotate this line
String toString()
Line translate(<Number> dx, <Number> dy, <Number> dz)
dx
- the x translation
dy
- the y translation
dz
- the z translation
|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |