Vector2 class

Vector2 class

A vector with two components.

The Vector2 type exposes the following members:

Constructors

ConstructorDescription
__init__(self, s)Initializes a new instance of the Vector2 struct.
__init__(self, s)Initializes a new instance of the Vector2 struct.
__init__(self, vec)Initializes a new instance of the Vector2 struct.
__init__(self, x, y)Initializes a new instance of the Vector2 struct.
__init__(self)Constructs a new instance of Vector2

Properties

PropertyDescription
uGets or sets the U component if the Vector2 is used as a mapping coordinate.
It’s an alias of x component.
vGets or sets the V component if the Vector2 is used as a mapping coordinate.
It’s an alias of y component.
lengthGets the length.
xThe x component.
yThe y component.

Methods

MethodDescription
dot(self, rhs)Gets the dot product of two vectors
equals(self, rhs)Check if two vector2 equals
cross(self, v)Cross product of two vectors
normalize(self)Normalizes this instance.
compare_to(self, other)Compare current vector to another instance.

See Also