22 lines
No EOL
3.4 KiB
HTML
22 lines
No EOL
3.4 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Angle — Ludic</title>
|
||
<meta name="description" content="An auto-wrapping angle in radians, so you never juggle % TAU by hand.">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Angle</span></div>
|
||
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Angle</h1></div>
|
||
<p class="ns-blurb">An auto-wrapping angle in radians, so you never juggle <code>% TAU</code> by hand. Every <code>Angle.*</code> result is normalized into <code>[-pi, pi)</code>, which makes <code>diff</code> the shortest signed rotation between two headings and <code>lerp</code> turn the short way around. Build from degrees with <code>Angle.from_degrees</code> (read back with <code>to_degrees</code>), take <code>sin</code> / <code>cos</code>, combine with <code>add</code>, and normalize any raw value with <code>wrap</code>. It builds on the deterministic fixed-point <code>Math.*</code> trig, so results are bit-identical on every platform. Arguments are positional; angles are <code>fixed</code> radians. Spliced in only when a program mentions <code>Angle.*</code>.</p>
|
||
<div class="ns-methods"><a class="ns-method" href="angle-from_degrees.html"><code class="nm-sig">Angle.from_degrees(d) -> fixed</code><span class="nm-tip">Degrees to a wrapped radian angle.</span></a><a class="ns-method" href="angle-to_degrees.html"><code class="nm-sig">Angle.to_degrees(a) -> fixed</code><span class="nm-tip">Radians back to degrees.</span></a><a class="ns-method" href="angle-wrap.html"><code class="nm-sig">Angle.wrap(a) -> fixed</code><span class="nm-tip">Normalize any radian value to [-pi, pi).</span></a><a class="ns-method" href="angle-sin.html"><code class="nm-sig">Angle.sin(a) -> fixed</code><span class="nm-tip">Sine of an angle.</span></a><a class="ns-method" href="angle-cos.html"><code class="nm-sig">Angle.cos(a) -> fixed</code><span class="nm-tip">Cosine of an angle.</span></a><a class="ns-method" href="angle-add.html"><code class="nm-sig">Angle.add(a, b) -> fixed</code><span class="nm-tip">Add two angles (wrapped).</span></a><a class="ns-method" href="angle-diff.html"><code class="nm-sig">Angle.diff(a, b) -> fixed</code><span class="nm-tip">Shortest signed rotation from a to b.</span></a><a class="ns-method" href="angle-lerp.html"><code class="nm-sig">Angle.lerp(a, b, t) -> fixed</code><span class="nm-tip">Interpolate along the shortest arc.</span></a><a class="ns-method" href="angle-diff_degrees.html"><code class="nm-sig">Angle.diff_degrees(a: int, b: int) -> int</code><span class="nm-tip">The signed difference between two headings in whole degrees.</span></a></div>
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |