gaia-math
Installation
SKILL.md
Math
Prefer Three.js math classes (Vector3, Euler, Quaternion, Matrix4) over custom implementations. They are well-tested, handle edge cases, and integrate seamlessly with Three.js objects.
Spherical Coordinates and Trigonometry
For spherical coordinates or anything involving sin/cos, use Euler, Vector3, and Quaternion rather than manual trigonometry:
// Instead of manual sin/cos for orbit position:
const spherical = new Spherical(radius, polarAngle, azimuthalAngle)
position.setFromSpherical(spherical)
// For direction from angles:
const euler = new Euler(pitch, yaw, 0, 'YXZ')
const direction = new Vector3(0, 0, -1).applyEuler(euler)