Class R.math.Point3D
Extends
R.math.PooledMathObject.
A 3D point class with helpful methods for manipulation
Defined in: point3d.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.math.Point3D(x, y, z)
Create a new 3D point.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
R.math.Point3D.ZERO
The "zero" point
|
Method Attributes | Method Name and Description |
---|---|
add(point)
A method that mutates this point by adding the point to it.
|
|
addScalar(scalar)
A mutator method that adds the scalar value to each component of this point.
|
|
convolve(point)
A mutator method that multiplies the components of this point with another.
|
|
convolveInverse(point)
A mutator method that divides the components of this point by another.
|
|
dist(point)
Returns the distance between this and another point.
|
|
div(scalar)
A mutator method that divides the components of this point by a scalar value.
|
|
equals(point)
Returns true if this point is equal to the specified point.
|
|
Return the classname of the this object
|
|
isZero()
Returns true if the point is the zero point.
|
|
mul(scalar)
A mutator method that multiplies the components of this point by a scalar value.
|
|
neg()
A mutator method that negates this point, inversing it's components.
|
|
release()
Release the point back into the pool for reuse
|
|
set(x, y, z)
Set the position of a 3D point.
|
|
setX(x)
Set the X coordinate.
|
|
setY(y)
Set the Y coordinate.
|
|
setZ(z)
Set the Z coordinate.
|
|
simplify()
Returns a simplified version of a R.math.Point3D.
|
|
sub(point)
A mutator method that subtracts the specified point from this point.
|
|
toString()
Returns a printable version of this object fixed to two decimal places.
|
- Methods borrowed from class R.math.PooledMathObject:
- destroy
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toXML
Class Detail
R.math.Point3D(x, y, z)
Create a new 3D point.
- Parameters:
- x
- {R.math.Point3D|Number} If this arg is a R.math.Point3D, its values will be copied into the new point.
- y
- {Number} The Y coordinate of the point. Only required if X was a number.
- z
- {Number} The Z coordinate of the point. Only required if X was a number.
Field Detail
<static>
R.math.Point3D.ZERO
The "zero" point
Method Detail
{R.math.Point3D}
add(point)
A method that mutates this point by adding the point to it.
- Parameters:
- point
- {R.math.Point3D} A point
- Returns:
- {R.math.Point3D} This point
{R.math.Point3D}
addScalar(scalar)
A mutator method that adds the scalar value to each component of this point.
- Parameters:
- scalar
- {Number} A number
- Returns:
- {R.math.Point3D} This point
{R.math.Point3D}
convolve(point)
A mutator method that multiplies the components of this point with another.
- Parameters:
- point
- {R.math.Point3D} A point
- Returns:
- {R.math.Point3D} This point
{R.math.Point3D}
convolveInverse(point)
A mutator method that divides the components of this point by another. The point
cannot contain zeros for its components.
- Parameters:
- point
- {R.math.Point3D} A point
- Returns:
- {R.math.Point3D} This point
{Number}
dist(point)
Returns the distance between this and another point.
- Parameters:
- point
- {R.math.Point3D} The point to compare against
- Returns:
- {Number} The distance between the two points
{R.math.Point3D}
div(scalar)
A mutator method that divides the components of this point by a scalar value.
- Parameters:
- scalar
- {Number} A number - cannot be zero
- Returns:
- {R.math.Point3D} This point
{Boolean}
equals(point)
Returns true if this point is equal to the specified point.
- Parameters:
- point
- {R.math.Point3D} The point to compare to
- Returns:
- {Boolean} true if the two points are equal
{String}
getClassName()
Return the classname of the this object
- Returns:
- {String} "R.math.Point3D"
{Boolean}
isZero()
Returns true if the point is the zero point.
- Returns:
- {Boolean} true if the point's elements are all zero.
{R.math.Point3D}
mul(scalar)
A mutator method that multiplies the components of this point by a scalar value.
- Parameters:
- scalar
- {Number} A number
- Returns:
- {R.math.Point3D} This point
{R.math.Point3D}
neg()
A mutator method that negates this point, inversing it's components.
- Returns:
- {R.math.Point3D} This point
release()
Release the point back into the pool for reuse
set(x, y, z)
Set the position of a 3D point.
- Parameters:
- x
- {R.math.Point3D|Number|Array} If this arg is a R.math.Point3D, its values will be copied into the new point.
- y
- {Number} The Y coordinate of the point. Only required if X was a number.
- z
- {Number} The Z coordinate of the point. Only required if X was a number.
setX(x)
Set the X coordinate.
- Parameters:
- x
- {Number} The X coordinate
setY(y)
Set the Y coordinate.
- Parameters:
- y
- {Number} The Y coordinate
setZ(z)
Set the Z coordinate.
- Parameters:
- z
- {Number} The Z coordinate
{Array}
simplify()
Returns a simplified version of a R.math.Point3D. The simplified version is
an array with three elements: X, Y, Z.
- Returns:
- {Array}
{R.math.Point3D}
sub(point)
A mutator method that subtracts the specified point from this point.
- Parameters:
- point
- {R.math.Point3D} a point
- Returns:
- {R.math.Point3D} This point
{String}
toString()
Returns a printable version of this object fixed to two decimal places.
- Returns:
- {String} Formatted as "x,y"