search API (or start typing anywhere)
Vector
differ.math.Vector
2D vector class
class
Members
x
x : FloatThe x component
y
y : FloatThe y component
Properties
length
length : FloatThe length of the vector lengthsq
lengthsq : FloatThe length, squared, of the vector
Methods
add
add(other:differ.math.Vector) : differ.math.VectorAdd a vector to this vector. Returns this vector, modified. clone
clone() : differ.math.VectorCopy, returns a new vector instance from this vector. cross
cross(other:differ.math.Vector) : FloatReturn the cross product of this vector and another vector. dot
dot(other:differ.math.Vector) : FloatReturn the dot product of this vector and another vector. invert
invert() : differ.math.VectorInvert this vector. Returns this vector, modified. new
new(_x:Float, _y:Float) : Voidnormalize
normalize() : differ.math.VectorSets the vector’s length to 1. Returns this vector, modified. subtract
subtract(other:differ.math.Vector) : differ.math.VectorSubtract a vector from this one. Returns this vector, modified. toString
toString() : StringReturn a string representation of this vector. transform
transform(matrix:differ.math.Matrix) : differ.math.VectorTransforms Vector based on the given Matrix. Returns this vector, modified. truncate
truncate(max:Float) : differ.math.VectorSets the length to fit under the given maximum value. Nothing is done if the vector is already shorter. Returns this vector, modified.
