How the Interactive Unit Circle Computes Trig Values
AnyTool’s Interactive Unit Circle is a draggable in-page SVG backed by a small pure trigonometry engine. When you drag the point, click the ring, slide, tap a common-angle button or type an angle, the pointer position is converted to an angle θ with atan2, optionally snapped to the nearest of the 16 standard angles, and normalised to the [0°, 360°) range. The engine then computes the point (cos θ, sin θ) and all six functions — tan θ = sin θ / cos θ, csc θ = 1/sin θ, sec θ = 1/cos θ, cot θ = cos θ / sin θ — using the reciprocal form so true singularities surface as infinities rather than huge finite numbers. Tiny floating-point dust such as cos 90° ≈ 6 × 10⁻¹⁷ is cleaned to exact 0, 1 or −1. The radian measure is formatted as a tidy multiple of π (π/6, 3π/4, and so on) by testing small denominators. Every calculation is deterministic and runs locally; nothing is sent to a server.
- Pointer → angle via atan2, optional snap to 16 standard angles
- Six functions from sin and cos; reciprocals expose true singularities
- Float dust (e.g. cos 90°) cleaned to exact 0, 1 or −1
- Radians formatted as multiples of π (π/6, 3π/4, …)
- Pure, unit-testable engine — no eval(), no server
