Package | com.derschmale.wick3d.core.math |
Class | public class Vector3D |
Subclasses | Vertex3D |
Property | Defined by | ||
---|---|---|---|
length : Number [read-only]
The length of the vector, or the distance from a point to the origin.
| Vector3D | ||
lengthSquared : Number [read-only]
The squared length of the vector, or the squared distance from a point to the origin.
| Vector3D | ||
w : Number
A number defining whether the vector is a direction vector (0) or a point (1).
| Vector3D | ||
x : Number
The x-coordinate of the vector
| Vector3D | ||
y : Number
The y-coordinate of the vector
| Vector3D | ||
z : Number
The z-coordinate of the vector
| Vector3D |
Method | Defined by | ||
---|---|---|---|
Vector3D(x:Number = 0, y:Number = 0, z:Number = 0, w:Number = 0)
Creates a new Vector3D object.
| Vector3D | ||
Adds a vector to the current vector, and returns the result as new instance.
| Vector3D | ||
angleBetween(a:Vector3D):Number
Calculates the angle between two vectors.
| Vector3D | ||
Creates a new vector that is an exact duplicate of the current.
| Vector3D | ||
Calculates the cross product of two vectors
| Vector3D | ||
decrementBy(a:Vector3D):void
Deducts a vector from the current one.
| Vector3D | ||
[static]
Calculates the distance between two points.
| Vector3D | ||
dotProduct(a:Vector3D):Number
Calculates the dot product of two vectors
| Vector3D | ||
Compares two vectors to see if they are equal.
| Vector3D | ||
incrementBy(a:Vector3D):void
Adds a vector to the current vector.
| Vector3D | ||
multiplyMatrix(m:Matrix3D):void
Multiplies this vector with a matrix;
| Vector3D | ||
nearEquals(toCompare:Vector3D, tolerance:Number = 0.0001, allFour:Boolean = false):Boolean
Compares two vectors to see if they are equal within a margin of error.
| Vector3D | ||
negate():void
Negates the current vector.
| Vector3D | ||
normalize():void
Scales the vector so it becomes unit length.
| Vector3D | ||
project():void
Divides the x, y and z coordinates by the w-component.
| Vector3D | ||
scaleBy(s:Number):void
Multiplies the vector by a scalar value
| Vector3D | ||
Deducts two vectors and returns the result as a new vector.
| Vector3D | ||
toString():String
Generates a string representation of the coordinates of the vector.
| Vector3D |
Constant | Defined by | ||
---|---|---|---|
XAXIS : Vector3D
[static]
The absolute x-axis
| Vector3D | ||
YAXIS : Vector3D
[static]
The absolute y-axis
| Vector3D | ||
ZAXIS : Vector3D
[static]
The absolute z-axis
| Vector3D |
length | property |
length:Number
[read-only]The length of the vector, or the distance from a point to the origin.
Implementation public function get length():Number
lengthSquared | property |
lengthSquared:Number
[read-only]The squared length of the vector, or the squared distance from a point to the origin.
Implementation public function get lengthSquared():Number
w | property |
public var w:Number
A number defining whether the vector is a direction vector (0) or a point (1). Points are translated, whereas Vectors aren't.
x | property |
public var x:Number
The x-coordinate of the vector
y | property |
public var y:Number
The y-coordinate of the vector
z | property |
public var z:Number
The z-coordinate of the vector
Vector3D | () | constructor |
public function Vector3D(x:Number = 0, y:Number = 0, z:Number = 0, w:Number = 0)
Creates a new Vector3D object.
Parametersx:Number (default = 0 ) — The x-coordinate of the vector
|
|
y:Number (default = 0 ) — The y-coordinate of the vector
|
|
z:Number (default = 0 ) — The z-coordinate of the vector
|
|
w:Number (default = 0 ) — A number defining whether the vector is a direction vector (0) or a point (1)
|
add | () | method |
public function add(a:Vector3D):Vector3D
Adds a vector to the current vector, and returns the result as new instance.
Parametersa:Vector3D |
Vector3D —
The sum of two vectors.
|
angleBetween | () | method |
public function angleBetween(a:Vector3D):Number
Calculates the angle between two vectors.
Parametersa:Vector3D |
Number — The angle between two vectors.
|
clone | () | method |
public function clone():Vector3D
Creates a new vector that is an exact duplicate of the current.
ReturnsVector3D —
A clone of the current vector.
|
crossProduct | () | method |
public function crossProduct(a:Vector3D):Vector3D
Calculates the cross product of two vectors
Parametersa:Vector3D |
Vector3D —
The cross product of two vectors.
|
decrementBy | () | method |
public function decrementBy(a:Vector3D):void
Deducts a vector from the current one.
Parametersa:Vector3D |
distance | () | method |
public static function distance(a:Vector3D, b:Vector3D):Number
Calculates the distance between two points.
Parametersa:Vector3D |
|
b:Vector3D |
Number |
dotProduct | () | method |
public function dotProduct(a:Vector3D):Number
Calculates the dot product of two vectors
Parametersa:Vector3D |
Number — The dot product of two vectors.
|
equals | () | method |
public function equals(toCompare:Vector3D, allFour:Boolean = false):Boolean
Compares two vectors to see if they are equal.
ParameterstoCompare:Vector3D — The vector to compare with the current.
|
|
allFour:Boolean (default = false ) — Defines if the w-coordinate should be used in the comparison.
|
Boolean — Whether or not the vectors are equal.
|
incrementBy | () | method |
public function incrementBy(a:Vector3D):void
Adds a vector to the current vector.
Parametersa:Vector3D |
multiplyMatrix | () | method |
public function multiplyMatrix(m:Matrix3D):void
Multiplies this vector with a matrix;
Parametersm:Matrix3D |
nearEquals | () | method |
public function nearEquals(toCompare:Vector3D, tolerance:Number = 0.0001, allFour:Boolean = false):Boolean
Compares two vectors to see if they are equal within a margin of error.
ParameterstoCompare:Vector3D — The vector to compare with the current.
|
|
tolerance:Number (default = 0.0001 ) — The maximum difference that each component is allowed to have to be considered equal.
|
|
allFour:Boolean (default = false ) — Defines if the w-coordinate should be used in the comparison.
|
Boolean — Whether or not the vectors are quasi equal.
|
negate | () | method |
public function negate():void
Negates the current vector.
normalize | () | method |
public function normalize():void
Scales the vector so it becomes unit length.
project | () | method |
public function project():void
Divides the x, y and z coordinates by the w-component.
scaleBy | () | method |
public function scaleBy(s:Number):void
Multiplies the vector by a scalar value
Parameterss:Number |
subtract | () | method |
public function subtract(a:Vector3D):Vector3D
Deducts two vectors and returns the result as a new vector.
Parametersa:Vector3D |
Vector3D —
The difference between to vectors.
|
toString | () | method |
public function toString():String
Generates a string representation of the coordinates of the vector.
ReturnsString — A String representation of the vector.
|
XAXIS | constant |
public static const XAXIS:Vector3D
The absolute x-axis
YAXIS | constant |
public static const YAXIS:Vector3D
The absolute y-axis
ZAXIS | constant |
public static const ZAXIS:Vector3D
The absolute z-axis