Packagecom.threerings.geom
Classpublic class Vector3

Basic 3D vector implementation.



Public Properties
 PropertyDefined by
  length : Number
[read-only] Returns this vector's length.
Vector3
  x : Number = 0
Vector components.
Vector3
  y : Number = 0
Vector3
  z : Number = 0
Vector3
Public Methods
 MethodDefined by
  
Vector3(x:Number = 0, y:Number = 0, z:Number = 0)
Creates a new vector.
Vector3
  
Returns a new vector that is the summation of this vector with vector v.
Vector3
  
Sets this vector to the result of summation with v, such that this = this + v.
Vector3
  
Returns a new vector that is a copy of this vector, with each coordinate clamped to within [0, 1].
Vector3
  
Duplicates a vector.
Vector3
  
Returns a new vector that is the cross product of this vector with vector v, such that result = this ⊗ v.
Vector3
  
Sets this vector to the result of a cross product with vector v, such that this = this ⊗ v.
Vector3
  
dot(v:Vector3):Number
Returns the dot product of this vector with vector v.
Vector3
  
[static] 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.
Vector3
  
Finds the intersection of a ray emitted from s along this vector, with a plane passing through point p with normal n.
Vector3
  
Returns a new vector that is a normalized version of this vector.
Vector3
  
Destructively normalizes this vector.
Vector3
  
scale(value:Number):Vector3
Returns a new vector that is the result of multiplying the current vector by the specified scalar.
Vector3
  
scaleLocal(value:Number):Vector3
Destructively multiplies this vector by the specified scalar.
Vector3
  
set(x:Number, y:Number, z:Number):void
Assigns values to the three parameters of this vector.
Vector3
  
Returns a new vector that is the subtraction of vector v from this vector.
Vector3
  
Sets the vector to the result of subtraction of v, such that this = this - v.
Vector3
  
toString():String
Vector3
Public Constants
 ConstantDefined by
  INFINITE : Vector3
[static] Infinite vector - often the result of normalizing a zero vector, or intersecting a vector with a parallel plane.
Vector3
Property detail
lengthproperty
length:Number  [read-only]

Returns this vector's length.

Implementation
    public function get length():Number
xproperty 
public var x:Number = 0

Vector components.

yproperty 
public var y:Number = 0
zproperty 
public var z:Number = 0
Constructor detail
Vector3()constructor
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)
Method detail
add()method
public function add(v:Vector3):Vector3

Returns a new vector that is the summation of this vector with vector v.

Parameters
v:Vector3

Returns
Vector3
addLocal()method 
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
v:Vector3

Returns
Vector3
clampToUnitBox()method 
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
Vector3
clone()method 
public function clone():Vector3

Duplicates a vector.

Returns
Vector3
cross()method 
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
v:Vector3

Returns
Vector3
crossLocal()method 
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
v:Vector3

Returns
Vector3
dot()method 
public function dot(v:Vector3):Number

Returns the dot product of this vector with vector v.

Parameters
v:Vector3

Returns
Number
interpolate()method 
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
a:Vector3
 
b:Vector3
 
p:Number

Returns
Vector3
intersection()method 
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
s:Vector3
 
p:Vector3
 
n:Vector3

Returns
Vector3
normalize()method 
public function normalize():Vector3

Returns a new vector that is a normalized version of this vector.

Returns
Vector3
normalizeLocal()method 
public function normalizeLocal():Vector3

Destructively normalizes this vector. Returns a reference to the modified self.

Returns
Vector3
scale()method 
public function scale(value:Number):Vector3

Returns a new vector that is the result of multiplying the current vector by the specified scalar.

Parameters
value:Number

Returns
Vector3
scaleLocal()method 
public function scaleLocal(value:Number):Vector3

Destructively multiplies this vector by the specified scalar. Returns a reference to the modified self.

Parameters
value:Number

Returns
Vector3
set()method 
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
subtract()method 
public function subtract(v:Vector3):Vector3

Returns a new vector that is the subtraction of vector v from this vector.

Parameters
v:Vector3

Returns
Vector3
subtractLocal()method 
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
v:Vector3

Returns
Vector3
toString()method 
public function toString():String

Returns
String
Constant detail
INFINITEconstant
public static const INFINITE:Vector3

Infinite vector - often the result of normalizing a zero vector, or intersecting a vector with a parallel plane.