Novelty scripting reference > Types > Vector2

Vector2

Two-dimentional vector.

Members

float x
float y


Constructors

Vector2()
Vector2(const Vector2 &in other)
Vector2(float x, float y)


Methods

void Set(float x, float y)
Set values.

void Add(float x, float y)
void Add(const Vector2 &in other)
Add another vector.

void Sub(float x, float y)
void Sub(const Vector2 &in other)
Subtract another vector.

void Scale(float factor)
Scale the vector by a factor.

void Interpolate(const Vector2 &in other, float value)
Do a linear interpolation between the vector and another.

float SquareLength() const
Returns square length of the vector.

float Length() const
Returns length of the vector.

float Dot(const Vector2 &in other) const
Calculates the dot product of the vector.

float Cross(const Vector2 &in other) const
Calculates the cross between of the vector and another.

void Normalize()
Normalize the vector.

Vector2 Normalized() const
Returns a normalized vector.

string AsString() const
Returns the vector as a string


Back to top