physics.py 947 Bytes
from vpython import sphere, vec, vector, color, cylinder, rate, cos, cross, mag, sin, pi  # type: ignore
sphere, vec, vector, color, cylinder, rate, cos, cross, mag, sin, pi  # type: ignore


POSITION: vector = vec(0, 0, 0)
SIZE: vector = vec(5, 0.5, 0.5)
DIRS: list[int] = [0, 1, -1]
RADIUS: int = 1


def setup() -> dict[tuple[int, int, int], cylinder]:
    ball: sphere = sphere(pos=POSITION, radius=RADIUS, color=color.yellow)
    res = {}
    return res


def rotate(v: vector, e: vector, angle: float) -> vector:
    """
    See https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula#Statement

    v + sin(theta) * (e x v) + (1 - cos(theta)) * (e x (e x v))

    """
    return v


def scale(v: vector, by: float) -> vector:
    return v


ANGLE: float = pi/64
CYLINDERS: dict[tuple[int, int, int], cylinder] = setup()

while True:
    rate(10)
    for i in DIRS:
        for j in DIRS:
            for k in DIRS:
                pass