|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Vector | +--point2D
The point2D class defines a point in 2-dimensional Euclidean space via homogeneous coordinates (i.e. as a 3-vector (x,y,1)). This allows affine transformations to be applied to 2-D points via matrix multiplication.
Defined in point2D.js
Requires:
Field Summary | |
Array |
components
The components of the 2D point. |
<final> Integer |
n
The "dimension" of the point; ALWAYS 2. |
Number |
x
The x value of the 2D point. |
Number |
y
The y value of the 2D point. |
<static> Object |
zero
|
Fields inherited from class Vector |
components, n
|
Constructor Summary | |
point2D(<Number> x, <Number> y)
Constructor function. |
Method Summary | |
point3D
|
make3D()
Converts a 2D point to a 3D point with a 0 z-component. |
point2D
|
map(func)
Maps this point to a new 2D point according to a given function. |
point2D
|
rotate(<Number> theta)
Rotates a point through a degree theta and returns a new point. |
String
|
toString()
Produces a string representation of the point. |
Vector
|
toVector()
Converts point2D object back to a Vector. |
point2D
|
translate(<Number> dx, <Number> dy)
Translates a point (x,y,1) to (x+dx, y+dy, 1). |
Methods inherited from class Vector |
get, toEach, equalTo, normalize, linearlyIndependent, linearlyDependent, add, subtract, round, multiplyBy, dot, cross, resolute, reflectionIn, negative, toColumnMatrix, toRowMatrix, getLength, angleBetween, isParallel, isAntiParallel, isPerpendicular, distanceFrom, dimension, snapTo, indexOf, max, elements, addElement, toPoint
|
Field Detail |
Array components
<final> Integer n
Number x
Number y
<static> Object zero
Constructor Detail |
point2D(<Number> x, <Number> y)
x
- the x component; if x is a point2D object, will create a duplicate of the point
y
- the y component
Method Detail |
point3D make3D()
point2D map(func)
func
- {Object} the mapping function
point2D rotate(<Number> theta)
theta
- the degree (in radians) by which to rotate the point
String toString()
Vector toVector()
point2D translate(<Number> dx, <Number> dy)
dx
- the x translation
dy
- the y translation
|
MathWorx | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |