search API (or start typing anywhere)
Vector
differ.math.Vector
2D vector class
class
Members
x
x : Float
The x component
y
y : Float
The y component
Properties
length
length : Float
The length of the vector lengthsq
lengthsq : Float
The length, squared, of the vector
Methods
add
add(other:differ.math.Vector) : differ.math.Vector
Add a vector to this vector. Returns this vector, modified. clone
clone() : differ.math.Vector
Copy, returns a new vector instance from this vector. cross
cross(other:differ.math.Vector) : Float
Return the cross product of this vector and another vector. dot
dot(other:differ.math.Vector) : Float
Return the dot product of this vector and another vector. invert
invert() : differ.math.Vector
Invert this vector. Returns this vector, modified. new
new(_x:Float, _y:Float) : Void
normalize
normalize() : differ.math.Vector
Sets the vector’s length to 1. Returns this vector, modified. subtract
subtract(other:differ.math.Vector) : differ.math.Vector
Subtract a vector from this one. Returns this vector, modified. toString
toString() : String
Return a string representation of this vector. transform
transform(matrix:differ.math.Matrix) : differ.math.Vector
Transforms Vector based on the given Matrix. Returns this vector, modified. truncate
truncate(max:Float) : differ.math.Vector
Sets the length to fit under the given maximum value. Nothing is done if the vector is already shorter. Returns this vector, modified.