pygame2.math – Vector math features used by pygame2

Vector math features used by pygame2

Module Functions

pygame2.math.vector_from_polar(p1, p2) → Vector2
TODO
pygame2.math.vector_from_spherical(p1, p2, p3) → Vector2
TODO

Vector

class pygame2.math.Vector → Vector
Creates a new Vector.

Attributes

Vector.dimension
Gets the dimensions of the Vector.
Vector.length
Gets the length of the Vector.
Vector.length_squared
Gets the length of the Vector.
Vector.epsilon
Gets or sets the exactness delta of the Vector.
Vector.elements

Gets or sets the elements of the Vector.

This will only set a maximum of dimension values.

Vector.normalized
Gets whether the Vector is normalized.

Methods

Vector.normalize() → Vector
TODO
Vector.normalize_ip() → None
TODO
Vector.slerp() → Vector
TODO
Vector.lerp() → Vector
TODO
Vector.dot() → float
TODO
Vector.scale_to(v) → Vector
TODO
Vector.reflect() → Vector
TODO
Vector.reflect_ip() → None
TODO
Vector.distance() → None
TODO
Vector.distance_squared() → None
TODO

Vector2

class pygame2.math.Vector2 → Vector2

Creates a new Vector2.

A simple 2D vector containing only two elements.

Attributes

Vector2.dimension
Gets the dimensions of the Vector2.
Vector2.elements

Gets or sets the elements of the Vector2.

This will only set a maximum of two values.

Vector2.x
Gets or sets first element of the Vector2.
Vector2.y
Gets or sets second element of the Vector2.

Methods

Vector2.rotate() → Vector2
TODO
Vector2.rotate_ip() → Vector2
TODO
Vector2.as_polar() → float, float
TODO
Vector2.angle_to(v) → float
TODO
Vector2.cross(v) → Vector2
TODO

Vector3

class pygame2.math.Vector3 → Vector3

Creates a new Vector3.

A simple 3D vector containing only three elements.

Attributes

Vector3.dimension
Gets the dimensions of the Vector3.
Vector3.elements

Gets or sets the elements of the Vector3.

This will only set a maximum of three values.

Vector3.x
Gets or sets first element of the Vector3.
Vector3.y
Gets or sets second element of the Vector3.
Vector3.z
Gets or sets third element of the Vector3.

Methods

Vector3.rotate_x() → Vector3
TODO
Vector3.rotate_x_ip() → None
TODO
Vector3.rotate_y() → Vector3
TODO
Vector3.rotate_y_ip() → None
TODO
Vector3.rotate_z() → Vector3
TODO
Vector3.rotate_z_ip() → None
TODO
Vector3.rotate() → Vector3
TODO
Vector3.rotate_ip() → Vector3
TODO
Vector3.angle_to(v) → float
TODO
Vector3.cross(v) → Vector3
TODO
Vector3.as_spherical() → float, float, float
TODO