Point3D represents a point in three-dimensional cartesian
coordinate space.
classType:Class [read-only]
Returns the actual type of the object - Point3D or Vector3D. Used by some
matrix operations.
Implementation
public function get classType():Class
public function Point3D(x:Number = 0, y:Number = 0, z:Number = 0)
Constructor
Parameters
| x:Number (default = 0) — the x coordinate of the point
|
| |
| y:Number (default = 0) — the y coordinate of the point
|
| |
| z:Number (default = 0) — the z coordinate of the point
|
public function add(v:Vector3D, result:Point3D = null):Point3D
Adds a vector to this point, translating this point according to the vector,
and returns the result.
Parameters
| v:Vector3D — the vector to add
|
| |
| result:Point3D (default = null) — The point to hold the result of the addition. If
no point is passed, a new point is created.
|
Returns
| Point3D —
the result of the addition
|
public function assign(p:Point3D):Point3D
Copies another point into this one.
Parameters
Returns
| Point3D —
a reference to this point
|
public function clone(result:Point3D = null):Point3D
Makes a copy of this point.
Parameters
| result:Point3D (default = null) — The point to hold the copy of this point. If
no point is passed, a new point is created.
|
Returns
public function decrementBy(v:Vector3D):Point3D
Subtract a vector from this point.
Parameters
Returns
| Point3D —
A reference to this point.
|
public function distance(p:Point3D):Number
Calculates the distance between two points.
Parameters
Returns
| Number — the distance between the points.
|
public function distanceSquared(p:Point3D):Number
Calculates the square of the distance between two points. This is faster than
calculating the actual distance.
Parameters
Returns
| Number — the square of the distance between the points.
|
public function divide(s:Number, result:Point3D = null):Point3D
Divide this point by a number, returning the result.
Parameters
| s:Number — The number to divide by
|
| |
| result:Point3D (default = null) — The point to hold the result of the divide. If
no point is passed, a new point is created.
|
Returns
| Point3D —
The result of the division
|
public function divideBy(s:Number):Point3D
Divide this point by a number.
Parameters
| s:Number — The number to divide by
|
Returns
| Point3D —
A reference to this point.
|
public function equals(p:Point3D):Boolean
Compare this point to another.
Parameters
| p:Point3D — The point to compare with
|
Returns
| Boolean — true if the points have the same coordinates, false otherwise
|
public function incrementBy(v:Vector3D):Point3D
Add a vector to this point.
Parameters
Returns
| Point3D —
A reference to this point.
|
public function multiply(s:Number, result:Point3D = null):Point3D
Multiply this point by a number, returning the result.
Parameters
| s:Number — The number to multiply by
|
| |
| result:Point3D (default = null) — The point to hold the result of the multiply. If
no point is passed, a new point is created.
|
Returns
| Point3D —
The result of the multiplication
|
public function nearTo(p:Point3D, e:Number):Boolean
Compare this point to another.
Parameters
| p:Point3D — The point to compare with
|
| |
| e:Number — The distance allowed between the points.
|
Returns
| Boolean — true if the points are within distance e of each other, false otherwise
|
public function project():Point3D
Divide all the coordinates in this popoint by the w coordinate,
producing a point with a w coordinate of 1.
Returns
| Point3D —
The projection of this point to a point with a w coordinate
of 1.
|
public function reset(x:Number = 0, y:Number = 0, z:Number = 0):Point3D
Assigns new coordinates to this point
Parameters
| x:Number (default = 0) — The new x coordinate
|
| |
| y:Number (default = 0) — The new y coordinate
|
| |
| z:Number (default = 0) — The new z coordinate
|
Returns
| Point3D —
a reference to this Point3D object
|
public function scaleBy(s:Number):Point3D
Multiply this point by a number.
Parameters
| s:Number — The number to multiply by
|
Returns
| Point3D —
A reference to this point.
|
public function subtract(v:Vector3D, result:Point3D = null):Point3D
Subtract a vector from this point, returning the result.
Parameters
| v:Vector3D — The vector to subtract
|
| |
| result:Point3D (default = null) — The point to hold the result of the subtraction. If
no point is passed, a new point is created.
|
Returns
| Point3D —
The result of the subtraction
|
public function toString():String
Get a string representation of this point
Returns
| String — a string representation of this point
|
public function toVector3D(v:Vector3D = null):Vector3DParameters
Returns
public function vectorTo(p:Point3D, result:Vector3D = null):Vector3D
Create the vector from this point to another point.
Parameters
| p:Point3D — The other point
|
| |
| result:Vector3D (default = null) — The vector to hold the result. If
no vector is passed, a new vector is created.
|
Returns
| Vector3D —
The result of the subtraction
|
public static const ZERO:Point3D
A zero point.
© Richard Lord 2010