Packageorg.ffilmation.utils
Classpublic class Vector

A 2d Vector class



Public Properties
 PropertyDefined by
  x : Number
X component
Vector
  y : Number
Y component
Vector
Public Methods
 MethodDefined by
  
Vector(vx:Number, vy:Number)
Constructor for this class
Vector
  
angleVector(V:Vector):Number
Returns angle between this instance and given parameter
Vector
  
dotProduct(V:Vector):Number
Calculates the dot product of this and given vectors
Vector
  
Defines perpendicular direction vector of this instance.
Vector
  
norm():Number
Calculates normal of this instance vector
Vector
  
normalize():void
Normalizes this instance.
Vector
  
toString():String
Generates a string from this vector.
Vector
  
Returns the unit vector of this instance.
Vector
Property detail
xproperty
public var x:Number

X component

yproperty 
public var y:Number

Y component

Constructor detail
Vector()constructor
public function Vector(vx:Number, vy:Number)

Constructor for this class

Parameters
vx:Number
 
vy:Number
Method detail
angleVector()method
public function angleVector(V:Vector):Number

Returns angle between this instance and given parameter

Parameters
V:Vector — vector

Returns
Number — the angle between this instance and the parameter
dotProduct()method 
public function dotProduct(V:Vector):Number

Calculates the dot product of this and given vectors

Parameters
V:Vector — second vector vector.

Returns
Number — returns the dot product of this instance and 'V'.
getPerpendicular()method 
public function getPerpendicular():Vector

Defines perpendicular direction vector of this instance.

Returns
Vector — A perpendicular direction vector of this instance.
norm()method 
public function norm():Number

Calculates normal of this instance vector

Returns
Number — returns normal of this instance.
normalize()method 
public function normalize():void

Normalizes this instance.

toString()method 
public function toString():String

Generates a string from this vector. Useful to debug

Returns
String — A string containing 2d class properties.
unitVector()method 
public function unitVector():Vector

Returns the unit vector of this instance.

Returns
Vector — A new Vector object populated with this instance's unit vector.