Quick Start
Basic Usage
Creating Frames
Every coordinate transformation starts with a root frame:
from hazy import Frame
world = Frame.make_root("world")
Create child frames with transformations:
camera = (
world.make_child("camera")
.translate(x=1, y=2, z=5)
.rotate_euler(y=90, degrees=True)
)
Working with Points
Create points in a frame:
point = world.point(1, 2, 3)
Transform points between frames:
point_in_camera = point.to_frame(camera)
Working with Vectors
Vectors are direction quantities (unaffected by translation):
direction = world.vector(0, 0, 1) # Looking down Z-axis
direction_in_camera = direction.to_frame(camera)
Type Safety
Points and vectors are distinct types with mathematically valid operations:
# Valid operations
v1 + v2 # Vector addition
point + vector # Point displacement
point - point # Vector between points
vector * 2 # Scalar multiplication
# Invalid operations (raise TypeError)
point + point # Can't add points
point * 2 # Can't scale points
Convert to NumPy
Opt out to raw arrays when needed:
import numpy as np
coords = np.array(point) # [x, y, z]
point * 2 # TypeError
np.array(point) * 2 # Works: [2x, 2y, 2z]
Next Steps
See Examples for detailed examples
Read the API Reference for complete API reference