ipygame.math
ipygame.math — Vector2 / Vector3 classes.
Vector2 Objects
Section titled “Vector2 Objects”class Vector2()2D vector compatible with pygame.math.Vector2.
__init__
Section titled “__init__”def __init__(x=0.0, y=None)def copy() -> "Vector2"length
Section titled “length”def length() -> floatlength_squared
Section titled “length_squared”def length_squared() -> floatmagnitude
Section titled “magnitude”def magnitude() -> floatnormalize
Section titled “normalize”def normalize() -> "Vector2"normalize_ip
Section titled “normalize_ip”def normalize_ip() -> Noneis_normalized
Section titled “is_normalized”def is_normalized() -> booldef dot(other) -> floatdef cross(other) -> floatdistance_to
Section titled “distance_to”def distance_to(other) -> floatdistance_squared_to
Section titled “distance_squared_to”def distance_squared_to(other) -> floatangle_to
Section titled “angle_to”def angle_to(other) -> floatAngle in degrees from self to other.
as_polar
Section titled “as_polar”def as_polar() -> tuple[float, float]from_polar
Section titled “from_polar”def from_polar(polar: tuple[float, float]) -> Nonerotate
Section titled “rotate”def rotate(angle: float) -> "Vector2"Return rotated copy (angle in degrees).
rotate_ip
Section titled “rotate_ip”def rotate_ip(angle: float) -> Nonerotate_rad
Section titled “rotate_rad”def rotate_rad(angle: float) -> "Vector2"rotate_rad_ip
Section titled “rotate_rad_ip”def rotate_rad_ip(angle: float) -> Nonereflect
Section titled “reflect”def reflect(normal) -> "Vector2"reflect_ip
Section titled “reflect_ip”def reflect_ip(normal) -> Nonedef lerp(other, t: float) -> "Vector2"def slerp(other, t: float) -> "Vector2"move_towards
Section titled “move_towards”def move_towards(target, max_distance: float) -> "Vector2"move_towards_ip
Section titled “move_towards_ip”def move_towards_ip(target, max_distance: float) -> Noneclamp_magnitude
Section titled “clamp_magnitude”def clamp_magnitude(max_length: float, min_length: float = 0) -> "Vector2"clamp_magnitude_ip
Section titled “clamp_magnitude_ip”def clamp_magnitude_ip(max_length: float, min_length: float = 0) -> Noneupdate
Section titled “update”def update(*args) -> Noneepsilon_compare
Section titled “epsilon_compare”def epsilon_compare(other, epsilon: float) -> boolVector3 Objects
Section titled “Vector3 Objects”class Vector3()Minimal Vector3 stub — not fully implemented.
__init__
Section titled “__init__”def __init__(x=0.0, y=0.0, z=0.0)