Basic 3D vector implementation.
length:Number
[read-only]
Returns this vector's length.
Implementation
public function get length():Number
public var x:Number = 0
Vector components.
public var y:Number = 0
public var z:Number = 0
public function Vector3(x:Number = 0, y:Number = 0, z:Number = 0)
Creates a new vector. All three X, Y, Z parameters are optional.
Parameters
| x:Number (default = 0 )
|
|
| y:Number (default = 0 )
|
|
| z:Number (default = 0 )
|
public function add(v:Vector3):Vector3
Returns a new vector that is the summation of this vector with vector v.
Parameters
Returns
public function addLocal(v:Vector3):Vector3
Sets this vector to the result of summation with v, such that this = this + v
.
Returns a reference to the modified self.
Parameters
Returns
public function clampToUnitBox():Vector3
Returns a new vector that is a copy of this vector, with each coordinate clamped
to within [0, 1]. Please note that this obviously does not preserve the
vector's original direction in space.
Returns
public function clone():Vector3
Duplicates a vector.
Returns
public function cross(v:Vector3):Vector3
Returns a new vector that is the cross product of this vector with vector v,
such that result = this ⊗ v
.
Parameters
Returns
public function crossLocal(v:Vector3):Vector3
Sets this vector to the result of a cross product with vector v, such that
this = this ⊗ v
. Returns a reference to the modified self.
Parameters
Returns
public function dot(v:Vector3):Number
Returns the dot product of this vector with vector v.
Parameters
Returns
public static function interpolate(a:Vector3, b:Vector3, p:Number):Vector3
Returns a new vector that is the linear interpolation of vectors a and b
at proportion p, where p is in [0, 1], p = 0 means the result is equal to a,
and p = 1 means the result is equal to b.
Parameters
Returns
public function intersection(s:Vector3, p:Vector3, n:Vector3):Vector3
Finds the intersection of a ray emitted from s along this vector,
with a plane passing through point p with normal n. Returns the point
of intersection, potentially infinite if the ray and plane are parallel.
Parameters
Returns
public function normalize():Vector3
Returns a new vector that is a normalized version of this vector.
Returns
public function normalizeLocal():Vector3
Destructively normalizes this vector. Returns a reference to the modified self.
Returns
public function scale(value:Number):Vector3
Returns a new vector that is the result of multiplying the current vector
by the specified scalar.
Parameters
Returns
public function scaleLocal(value:Number):Vector3
Destructively multiplies this vector by the specified scalar.
Returns a reference to the modified self.
Parameters
Returns
public function set(x:Number, y:Number, z:Number):void
Assigns values to the three parameters of this vector.
Parameters
| x:Number |
|
| y:Number |
|
| z:Number |
public function subtract(v:Vector3):Vector3
Returns a new vector that is the subtraction of vector v from this vector.
Parameters
Returns
public function subtractLocal(v:Vector3):Vector3
Sets the vector to the result of subtraction of v, such that this = this - v
.
Returns a reference to the modified self.
Parameters
Returns
public function toString():String
Returns
public static const INFINITE:Vector3
Infinite vector - often the result of normalizing a zero vector, or intersecting
a vector with a parallel plane.
Copyright © 2007-2009 Three Rings Design, Inc.