Skip to content

Instantly share code, notes, and snippets.

@xoofee
xoofee / generate_compass_calib_phone_figure8_gif
Last active May 27, 2026 05:58
Generate a GIF for compass 8-figure calibration in phone
#!/usr/bin/env python3
"""Generate a white-background phone figure-eight calibration GIF.
This script builds the phone and the figure-eight path in 3D first, then renders
them through a simple perspective camera. The phone is a thin cuboid that moves
like a train on the track; the visible screen/back/side faces come from the
projection and face orientation instead of 2D shape rules.
"""
from __future__ import annotations