| Package | sandy.core.data |
| Class | public final class Vector |
A representation of a position in a 3D space.
| Method | Defined by | ||
|---|---|---|---|
|
Vector(p_nX:Number = 0, p_nY:Number = 0, p_nZ:Number = 0)
Creates a new vector instance.
| Vector | ||
|
Adds a specified vector to this vector.
| Vector | ||
|
Returns a clone of thei vector.
| Vector | ||
|
Makes this vector a copy of the specified vector.
| Vector | ||
|
Computes and returns the cross between this vector and the specified vector.
| Vector | ||
|
deserialize(convertFrom:String):void
Sets the elements of this vector from a string representation.
| Vector | ||
|
Computes and returns the dot product between this vector and the specified vector.
| Vector | ||
|
Is this vector equal to the specified vector?.
| Vector | ||
|
Returns the angle between this vector and the specified vector.
| Vector | ||
|
getMaxComponent():Number
Gives the biggest component of the current vector.
| Vector | ||
|
getMinComponent():Number
Gives the smallest component of the current vector.
| Vector | ||
|
getNorm():Number
Computes and returns the norm of this vector.
| Vector | ||
|
Compute and returns the invers of this vector.
| Vector | ||
|
normalize():void
Normalizes this vector.
| Vector | ||
|
pow(pow:Number):void
Raises this vector to the specified power.
| Vector | ||
|
reset():void
Reset the vector components to 0
after calling this method, x, y and z will be set to 0
| Vector | ||
|
resetToNegativeInfinity():void
Reset the vector components to the minimal value Flash can handle
after calling this method, x, y and z will be set to Number.NEGATIVE_INFINITY;
| Vector | ||
|
resetToPositiveInfinity():void
Reset the vector components to the maximal value Flash can handle
after calling this method, x, y and z will be set to Number.POSITIVE_INFINITY;
| Vector | ||
|
scale(n:Number):void
Multiplies this vector by the specified scalar.
| Vector | ||
|
serialize(decPlaces:Number = 0):String
Returns a string representation of this vector with rounded values.
| Vector | ||
|
Substracts the specified vector from this vector.
| Vector | ||
|
toString(decPlaces:Number = 0):String
Returns a string representing this vector.
| Vector | ||
| x | property |
public var x:Number
| y | property |
public var y:Number
| z | property |
public var z:Number
| Vector | () | constructor |
public function Vector(p_nX:Number = 0, p_nY:Number = 0, p_nZ:Number = 0)Creates a new vector instance.
Parametersp_nX:Number (default = 0) — the x coordinate
|
|
p_nY:Number (default = 0) — the y coordinate
|
|
p_nZ:Number (default = 0) — the z coordinate
|
| add | () | method |
public final function add(v:Vector):voidAdds a specified vector to this vector.
Parametersv:Vector — The vector to add
|
| clone | () | method |
| copy | () | method |
public final function copy(p_oVector:Vector):voidMakes this vector a copy of the specified vector.
All elements of this vector is set to those of the argument vector
Parametersp_oVector:Vector — The vector to copy
|
| cross | () | method |
public final function cross(v:Vector):VectorComputes and returns the cross between this vector and the specified vector.
Parametersv:Vector — The vector to make the cross product with ( right side )
|
Vector —
The cross product vector.
|
| deserialize | () | method |
public final function deserialize(convertFrom:String):voidSets the elements of this vector from a string representation.
[ToDo: Explain why this is good for XML intput! ]
ParametersconvertFrom:String — A string representing the vector ( specific serialize format )
|
| dot | () | method |
public final function dot(w:Vector):NumberComputes and returns the dot product between this vector and the specified vector.
Parametersw:Vector — The vector to multiply
|
Number — The dot procuct
|
| equals | () | method |
public final function equals(p_vector:Vector):BooleanIs this vector equal to the specified vector?.
Compares this vector with the vector passed in the argument.
If all components in the two vectors are equal a value of true is returned.
p_vector:Vector |
Boolean — true if the the two vectors are equal, fals otherwise.
|
| getAngle | () | method |
public final function getAngle(w:Vector):NumberReturns the angle between this vector and the specified vector.
Parametersw:Vector — The vector making an angle with this one
|
Number — The angle in radians
|
| getMaxComponent | () | method |
public final function getMaxComponent():NumberGives the biggest component of the current vector. Example : var lMax:Number = new Vector(5, 6.7, -4).getMaxComponent(); //returns 6.7
ReturnsNumber — The biggest component value of the vector
|
| getMinComponent | () | method |
public final function getMinComponent():NumberGives the smallest component of the current vector. Example : var lMin:Number = new Vector(5, 6.7, -4).getMinComponent(); //returns -4
ReturnsNumber — The smallest component value of the vector
|
| getNorm | () | method |
public final function getNorm():NumberComputes and returns the norm of this vector.
The norm of the vector is sqrt( x + y + z )
ReturnsNumber — The norm
|
| negate | () | method |
public final function negate():VectorCompute and returns the invers of this vector.
ReturnsVector —
The inverse
|
| normalize | () | method |
public final function normalize():voidNormalizes this vector.
After normalizing the vector, the direction is the same, but the length is = 1.
| pow | () | method |
public final function pow(pow:Number):voidRaises this vector to the specified power.
Each component of the vector is raised to the argument power.
So x = Math.pow( x, pow ), y = Math.pow( y, pow ),z = Math.pow( z, pow )
pow:Number — { |
| reset | () | method |
public function reset():voidReset the vector components to 0 after calling this method, x, y and z will be set to 0
| resetToNegativeInfinity | () | method |
public function resetToNegativeInfinity():voidReset the vector components to the minimal value Flash can handle after calling this method, x, y and z will be set to Number.NEGATIVE_INFINITY;
| resetToPositiveInfinity | () | method |
public function resetToPositiveInfinity():voidReset the vector components to the maximal value Flash can handle after calling this method, x, y and z will be set to Number.POSITIVE_INFINITY;
| scale | () | method |
public final function scale(n:Number):voidMultiplies this vector by the specified scalar.
Parametersn:Number — { |
| serialize | () | method |
public final function serialize(decPlaces:Number = 0):StringReturns a string representation of this vector with rounded values.
[ToDo: Explain why this is good for XML output! ]
ParametersdecPlaces:Number (default = 0) — Number of decimals
|
String — The specific serialize string
|
| sub | () | method |
public final function sub(v:Vector):voidSubstracts the specified vector from this vector.
Parametersv:Vector — { |
| toString | () | method |
public final function toString(decPlaces:Number = 0):StringReturns a string representing this vector.
ParametersdecPlaces:Number (default = 0) — Number of decimals
|
String — The string representatation
|