| Package | graphics.geom |
| Class | public class Vector3 |
| Inheritance | Vector3 Object |
| Implements | Geometry |
| Subclasses | Vertex |
| Property | Defined By | ||
|---|---|---|---|
| length : Number [read-only]
Indicates the length of the vector. | Vector3 | ||
| x : Number
Defines the x coordinate. | Vector3 | ||
| y : Number
Defines the y coordinate. | Vector3 | ||
| z : Number
Defined the z coordinate. | Vector3 | ||
| ZERO : Vector3 [static]
Defines the Vector3 object with the x, y and z properties set to zero. | Vector3 | ||
| Method | Defined By | ||
|---|---|---|---|
Vector3(x:Number = 0, y:Number = 0, z:Number = 0)
Creates a new Vector3 instance. | Vector3 | ||
Computes the addition of two vectors. | Vector3 | ||
[static]
Computes the addition of two Vector3. | Vector3 | ||
[static]
Returns the angle in radian between the two 3D vectors. | Vector3 | ||
clone():*
Returns a shallow copy of this instance. | Vector3 | ||
Computes the cross product of two Vector3s. | Vector3 | ||
Returns the dot value of the passed-in Vector3 with the current Vector3 object. | Vector3 | ||
equals(o:*):Boolean
Compares the specified object with this object for equality. | Vector3 | ||
negate():void
Sets this Vector2 with negate coordinates. | Vector3 | ||
[static]
Returns the new negate Vector2 of the specified Vector2 objet. | Vector3 | ||
normalize():Boolean
Normalize the vector. | Vector3 | ||
perspective(distance:Number = 300):Number
Calculates and returns the perspective ratio needed to scale an object correctly. | Vector3 | ||
pow(value:Number):void
Computes the power of the vector. | Vector3 | ||
[static]
Computes the power of the specified Vector3. | Vector3 | ||
project(perspective:Number):void
Performs a perspective projection on a 3d point. | Vector3 | ||
[static]
Performs a perspective projection on a 3d point. | Vector3 | ||
rotateX(angle:Number):void
Rotates the current vector object around the x-axis by a certain amount of degrees. | Vector3 | ||
rotateXTrig(ca:Number, sa:Number):void
Rotates the current vector object around the x-axis by the cosine and sine of an angle. | Vector3 | ||
rotateXY(a:Number, b:Number):void
Rotates the current vector object around the x and y axes by a certain amount of degrees. | Vector3 | ||
rotateXYTrig(ca:Number, sa:Number, cb:Number, sb:Number):void
Rotates the current vector object around the x and y axes by the cosine and sine of an angle. | Vector3 | ||
Rotates the current vector object around the x, y and z axes by a certain amount of degrees. | Vector3 | ||
rotateXYZTrig(ca:Number, sa:Number, cb:Number, sb:Number, cc:Number, sc:Number):void
Rotates the current vector object around the x, y and z axes by the cosine and sine of an angle. | Vector3 | ||
rotateY(angle:Number):void
Rotates the current vector object around the y-axis by a certain amount of degrees. | Vector3 | ||
rotateYTrig(ca:Number, sa:Number):void
Rotates the current vector object around the y-axis by the cosine and sine of an angle. | Vector3 | ||
rotateZ(angle:Number):void
Rotates the current vector object around the z-axis by a certain amount of degrees. | Vector3 | ||
rotateZTrig(ca:Number, sa:Number):void
Rotates the current vector object around the z-axis by the cosine and sine of an angle. | Vector3 | ||
scale(value:Number):void
Scales the vector object with the input value. | Vector3 | ||
[static]
Scales a new Vector3 object with the input value. | Vector3 | ||
Sets the specified Vector3 object with the second Vector3 object passed in argument. | Vector3 | ||
squaredLength():Number
Returns the squared length of this vector. | Vector3 | ||
Computes the substraction of the current vector object with an other. | Vector3 | ||
[static]
Computes the substraction of two Vector3 and creates a new Vector3. | Vector3 | ||
Swap the horizontal and vertical coordinates of two Vector2 objects. | Vector3 | ||
toObject():Object
Returns the Object representation of this object. | Vector3 | ||
toSource(indent:int = 0):String
Returns the source code string representation of the object. | Vector3 | ||
toString():String
Returns the string representation of the object. | Vector3 | ||
| Constant | Defined By | ||
|---|---|---|---|
| BACKWARD : Vector3 [static]
Indicates the relative "backward" direction. | Vector3 | ||
| DOWN : Vector3 [static]
Indicates the relative "down" direction. | Vector3 | ||
| FORWARD : Vector3 [static]
Indicates the relative "forward" direction. | Vector3 | ||
| LEFT : Vector3 [static]
Indicates the relative "left" direction. | Vector3 | ||
| RIGHT : Vector3 [static]
Indicates the relative "right" direction. | Vector3 | ||
| UP : Vector3 [static]
Indicates the relative "up" direction. | Vector3 | ||
| length | property |
length:Number [read-only] Indicates the length of the vector.
public function get length():Number| x | property |
public var x:NumberDefines the x coordinate.
| y | property |
public var y:NumberDefines the y coordinate.
| z | property |
public var z:NumberDefined the z coordinate.
| ZERO | property |
public static var ZERO:Vector3Defines the Vector3 object with the x, y and z properties set to zero.
| Vector3 | () | Constructor |
public function Vector3(x:Number = 0, y:Number = 0, z:Number = 0)
Creates a new Vector3 instance.
x:Number (default = 0) — the x coordinate.
| |
y:Number (default = 0) — the y coordinate.
| |
z:Number (default = 0) — the z coordinate.
|
| add | () | method |
public function add(v:Vector3):voidComputes the addition of two vectors.
Parameters
v:Vector3 — the vector object to add.
|
| add | () | method |
public static function add(v1:Vector3, v2:Vector3):Vector3Computes the addition of two Vector3.
Parameters
v1:Vector3 — a Vector3 to concat.
| |
v2:Vector3 — a Vector3 to concat.
|
Vector3 — the addition result of two Vector3.
|
| angle | () | method |
public static function angle(v1:Vector3, v2:Vector3):NumberReturns the angle in radian between the two 3D vectors. The formula used here is very simple. It comes from the definition of the dot product between two vectors.
Parameters
v1:Vector3 — Vector3 The first Vector3.
| |
v2:Vector3 — Vector3 The second Vector3.
|
Number — the angle in radian between the two vectors.
|
| clone | () | method |
public function clone():*Returns a shallow copy of this instance.
Returns* — a shallow copy of this instance.
|
| cross | () | method |
public function cross(vector:Vector3):Vector3Computes the cross product of two Vector3s.
Parameters
vector:Vector3 — The Vector3 reference.
|
Vector3 — the Vector3 resulting of the cross product.
|
| dot | () | method |
public function dot(vector:Vector3):NumberReturns the dot value of the passed-in Vector3 with the current Vector3 object.
Example :
import graphics.geom.Vector3 ;
var v1:Vector3 = new Vector3(10,20,30) ;
var v2:Vector3 = new Vector3(40,60,70) ;
trace( v1.dot( v2 ) ) ;
Parameters
vector:Vector3 — the Vector2 object to calculate the dot value.
|
Number — the dot value.
|
| equals | () | method |
public function equals(o:*):BooleanCompares the specified object with this object for equality.
Parameters
o:* |
Boolean — true if the the specified object is equal with this object.
|
| negate | () | method |
public function negate():voidSets this Vector2 with negate coordinates.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Vector3(10,20,30) ;
trace(v) ; // [Vector3 x:10 y:20 z:30]
v.negate() ;
trace(v) ; // [Vector3 x:-10 y:-20 z:-30]
v.negate() ;
trace(v) ; // [Vector3 x:10 y:20 z:30]
| negate | () | method |
public static function negate(vector:Vector3):Vector3Returns the new negate Vector2 of the specified Vector2 objet.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Point(10,20,30) ;
var n:Vector3 = Vector3.negate( v ) ;
trace(n) ; // [Vector3 x:-10 y:-20 z:-30]
Parameters
vector:Vector3 |
Vector3 — The new negate Vector3 of the specified Vector2 objet.
|
| normalize | () | method |
public function normalize():BooleanNormalize the vector.
ReturnsBoolean — true of the normalize method is success else false for mistake.
|
| perspective | () | method |
public function perspective(distance:Number = 300):NumberCalculates and returns the perspective ratio needed to scale an object correctly.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Vector3(50,20,40);
var p:Number = v.perspective();
trace(p) ;
Parameters
distance:Number (default = 300) — The viewing distance of the projection (default value 300).
|
Number — the perspective ratio needed to scale an object correctly.
|
| pow | () | method |
public function pow(value:Number):voidComputes the power of the vector.
Parameters
value:Number — the value of the pow..
|
| pow | () | method |
public static function pow(vector:Vector3, value:Number):Vector3Computes the power of the specified Vector3.
Parameters
vector:Vector3 — the Vector3 reference.
| |
value:Number — the value of the pow..
|
Vector3 — A new Vector3 powered by the method.
|
| project | () | method |
public function project(perspective:Number):voidPerforms a perspective projection on a 3d point. It converts (x, y, z) coordinates to a 2d location (x, y) on the screen.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Vector3(50,20,40) ;
v.project();
trace(v) ;
Parameters
perspective:Number — the Vector3 reference.
|
| project | () | method |
public static function project(v:Vector3, perspective:Number):Vector3Performs a perspective projection on a 3d point. It converts (x, y, z) coordinates to a 2d location (x, y) on the screen.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Vector3(50,20,40) ;
var p:Vector3 = Vector3.project(v);
trace(v + " / " + p) ;
Parameters
v:Vector3 — The perspective ratio. If no value is specified, it is calculated automatically by calling the getPerspective() method.
| |
perspective:Number |
Vector3 |
| rotateX | () | method |
public function rotateX(angle:Number):voidRotates the current vector object around the x-axis by a certain amount of degrees.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Vector3(1,4,7) ;
v.rotateX( 180 );
trace( v ) ;
Parameters
angle:Number — The amount of degrees that the current vector object will be rotated by.
|
| rotateXTrig | () | method |
public function rotateXTrig(ca:Number, sa:Number):voidRotates the current vector object around the x-axis by the cosine and sine of an angle.
Example :
import graphics.geom.Vector3 ;
import graphics.numeric.Degrees ;
var v:Vector3 = new Vector3(1,4,7);
var cosAngle:Number = cosD(180);
var sinAngle:Number = sinD(180);
v.rotateXTrig( cosAngle , sinAngle ) ;
trace (v);
Parameters
ca:Number — The cosine of the angle to rotate the current vector object by.
| |
sa:Number — The sine of the angle to rotate the current vector object by.
|
| rotateXY | () | method |
public function rotateXY(a:Number, b:Number):voidRotates the current vector object around the x and y axes by a certain amount of degrees.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Vector3(8,0,0) ;
v.rotateXY( 45 , 45 ) ;
trace(v) ;
Parameters
a:Number — The amount of degrees that the current vector object will be rotated around the x-axis by.
| |
b:Number — The amount of degrees that the current vector object will be rotated around the y-axis by.
|
| rotateXYTrig | () | method |
public function rotateXYTrig(ca:Number, sa:Number, cb:Number, sb:Number):voidRotates the current vector object around the x and y axes by the cosine and sine of an angle.
Example :
import graphics.geom.Vector3 ;
import graphics.numeric.Degrees ;
var v:Vector3 = new Vector3(6,1,4) ;
var cosAngleA:Number = cosD(45) ;
var sinAngleA:Number = sinD(45) ;
var cosAngleB:Number = cosD(90) ;
var sinAngleB:Number = sinD(90) ;
v.rotateXYTrig( cosAngleA, sinAngleA, cosAngleB, sinAngleB ) ;
trace(v) ;
Parameters
ca:Number — The cosine of the angle to rotate the current vector object around the x-axis by.
| |
sa:Number — The sine of the angle to rotate the current vector object around the x-axis by.
| |
cb:Number — The cosine of the angle to rotate the current vector object around the y-axis by.
| |
sb:Number — The sine of the angle to rotate the current vector object around the y-axis by.
|
| rotateXYZ | () | method |
public function rotateXYZ(v:Vector3, a:Number, b:Number, c:Number):voidRotates the current vector object around the x, y and z axes by a certain amount of degrees.
Example :
import graphics.geom.Vector3
var v:Vector3 = new Vector3(8,0,0);
v.rotateXYZ(45,45,45);
trace (v);
Parameters
v:Vector3 — The amount of degrees that the current vector object will be rotated around the x-axis by.
| |
a:Number — The amount of degrees that the current vector object will be rotated around the y-axis by.
| |
b:Number — The amount of degrees that the current vector object will be rotated around the z-axis by.
| |
c:Number |
| rotateXYZTrig | () | method |
public function rotateXYZTrig(ca:Number, sa:Number, cb:Number, sb:Number, cc:Number, sc:Number):voidRotates the current vector object around the x, y and z axes by the cosine and sine of an angle.
Example :
import graphics.geom.Vector3 ;
import graphics.numeric.Degrees ;
var v:Vector3 = new Vector3(6,1,4) ;
var cosAngleA:Number = cosD(45) ;
var sinAngleA:Number = sinD(45) ;
var cosAngleB:Number = cosD(90) ;
var sinAngleB:Number = sinD(90) ;
var cosAngleC:Number = cosD(135) ;
var sinAngleC:Number = sinD(135) ;
v.rotateXYZTrig( cosAngleA, sinAngleA, cosAngleB, sinAngleB, cosAngleC, sinAngleC ) ;
trace(v) ;
Parameters
ca:Number — The cosine of the angle to rotate the current vector object around the x-axis by.
| |
sa:Number — The sine of the angle to rotate the current vector object around the x-axis by.
| |
cb:Number — The cosine of the angle to rotate the current vector object around the y-axis by.
| |
sb:Number — The sine of the angle to rotate the current vector object around the y-axis by.
| |
cc:Number — The cosine of the angle to rotate the current vector object around the z-axis by.
| |
sc:Number — The sine of the angle to rotate the current vector object around the z-axis by.
|
| rotateY | () | method |
public function rotateY(angle:Number):voidRotates the current vector object around the y-axis by a certain amount of degrees.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Vector3(1,4,7);
v.rotateY( 180 );
trace(v);
Parameters
angle:Number — The amount of degrees that the current vector object will be rotated by.
|
| rotateYTrig | () | method |
public function rotateYTrig(ca:Number, sa:Number):voidRotates the current vector object around the y-axis by the cosine and sine of an angle.
Example :
import graphics.geom.Vector3 ;
import graphics.numeric.Degrees ;
var v:Vector3 = new Vector3(3,-8,5);
var cosAngle:Number = Trigo.cosD(90);
var sinAngle:Number = Trigo.sinD(90);
v.rotateYTrig( cosAngle, sinAngle ) ;
trace(v) ;
Parameters
ca:Number — The cosine of the angle to rotate the current vector object by.
| |
sa:Number — The sine of the angle to rotate the current vector object by.
|
| rotateZ | () | method |
public function rotateZ(angle:Number):voidRotates the current vector object around the z-axis by a certain amount of degrees.
Example :
import graphics.geom.Vector3 ;
var v:Vector3 = new Vector3(1,4,7) ;
v.rotateZ( 180 ) ;
trace(v);
Parameters
angle:Number — The amount of degrees that the current vector object will be rotated by.
|
| rotateZTrig | () | method |
public function rotateZTrig(ca:Number, sa:Number):voidRotates the current vector object around the z-axis by the cosine and sine of an angle.
Example :
import graphics.geom.Vector3 ;
import graphics.numeric.Degrees ;
var v:Vector3 = new Vector3(6,1,4) ;
var cosAngle:Number = cosD(45) ;
var sinAngle:Number = sinD(45) ;
v.rotateZTrig( cosAngle , sinAngle ) ;
trace(v);
Parameters
ca:Number — The cosine of the angle to rotate the current vector object by.
| |
sa:Number — The sine of the angle to rotate the current vector object by.
|
| scale | () | method |
public function scale(value:Number):voidScales the vector object with the input value.
Parameters
value:Number — a real number to scale the current vector object.
|
| scale | () | method |
public static function scale(v:Vector3, value:Number):Vector3Scales a new Vector3 object with the input value.
Parameters
v:Vector3 — the Vector3 reference to transform.
| |
value:Number — a real number to scale the current Vector3.
|
Vector3 — A new Vector3 scaled by the value passed in in this method.
|
| set | () | method |
public function set(vector:Vector3):void
Sets the specified Vector3 object with the second Vector3 object passed in argument.
Parameters
vector:Vector3 — the Vector3 to set the current Vector3.
|
| squaredLength | () | method |
public function squaredLength():NumberReturns the squared length of this vector.
ReturnsNumber — the squared length of this vector.
|
| substract | () | method |
public function substract(v:Vector3):voidComputes the substraction of the current vector object with an other.
Parameters
v:Vector3 — the vector to substract.
|
| substract | () | method |
public static function substract(v1:Vector3, v2:Vector3):Vector3Computes the substraction of two Vector3 and creates a new Vector3.
Parameters
v1:Vector3 — a Vector3 to substract.
| |
v2:Vector3 — a Vector3.
|
Vector3 — the substraction result of two Vector3.
|
| swap | () | method |
public function swap(vector:Vector3):voidSwap the horizontal and vertical coordinates of two Vector2 objects.
Example :
import graphics.geom.Vector3 ;
var v1:Vector3 = new Vector3( 10 , 20 , 30) ;
var v2:Vector3 = new Vector3( 40 , 50 , 60) ;
trace( v1 + " / " + v2 ) ; // [Vector3 x:10 y:20 z:30] / [Vector3 x:40 y:50 z:60]
v1.swap( v2 ) ;
trace( v1 + " / " + v2 ) ; // [Vector3 x:40 y:50 z:60] / [Vector3 x:10 y:20 z:30]
Parameters
vector:Vector3 |
| toObject | () | method |
public function toObject():ObjectReturns the Object representation of this object.
ReturnsObject — the Object representation of this object.
|
| toSource | () | method |
public function toSource(indent:int = 0):StringReturns the source code string representation of the object.
Parameters
indent:int (default = 0) |
String — the source code string representation of the object.
|
| toString | () | method |
public function toString():StringReturns the string representation of the object.
ReturnsString — the string representation of the object.
|
| BACKWARD | Constant |
public static const BACKWARD:Vector3Indicates the relative "backward" direction.
| DOWN | Constant |
public static const DOWN:Vector3Indicates the relative "down" direction.
| FORWARD | Constant |
public static const FORWARD:Vector3Indicates the relative "forward" direction.
| LEFT | Constant |
public static const LEFT:Vector3Indicates the relative "left" direction.
| RIGHT | Constant |
public static const RIGHT:Vector3Indicates the relative "right" direction.
| UP | Constant |
public static const UP:Vector3Indicates the relative "up" direction.