22 lines
No EOL
4 KiB
HTML
22 lines
No EOL
4 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Vector — Ludic</title>
|
||
<meta name="description" content="2D vector math for positions, velocities, and directions.">
|
||
<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">Vector</span></div>
|
||
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Vector</h1></div>
|
||
<p class="ns-blurb">2D vector math for positions, velocities, and directions. A <code>Vector</code> is a pair of Q16.16 fixed components packed into one value, so it is copied by value and never allocates. Every operation is deterministic integer fixed-point — bit-identical on every platform, the same guarantee the rest of the runtime gives. Arguments are positional; angles are in radians.</p>
|
||
<div class="ns-methods"><a class="ns-method" href="vector-make.html"><code class="nm-sig">Vector.make(x, y) -> Vector</code><span class="nm-tip">Build a vector from x and y components.</span></a><a class="ns-method" href="vector-zero.html"><code class="nm-sig">Vector.zero() -> Vector</code><span class="nm-tip">The zero vector, (0, 0).</span></a><a class="ns-method" href="vector-x.html"><code class="nm-sig">Vector.x(v) -> fixed</code><span class="nm-tip">The x component of a vector.</span></a><a class="ns-method" href="vector-y.html"><code class="nm-sig">Vector.y(v) -> fixed</code><span class="nm-tip">The y component of a vector.</span></a><a class="ns-method" href="vector-add.html"><code class="nm-sig">Vector.add(a, b) -> Vector</code><span class="nm-tip">Component-wise sum a + b.</span></a><a class="ns-method" href="vector-sub.html"><code class="nm-sig">Vector.sub(a, b) -> Vector</code><span class="nm-tip">Component-wise difference a - b.</span></a><a class="ns-method" href="vector-scale.html"><code class="nm-sig">Vector.scale(v, s) -> Vector</code><span class="nm-tip">Scale a vector by a scalar.</span></a><a class="ns-method" href="vector-dot.html"><code class="nm-sig">Vector.dot(a, b) -> fixed</code><span class="nm-tip">The dot product of two vectors.</span></a><a class="ns-method" href="vector-length.html"><code class="nm-sig">Vector.length(v) -> fixed</code><span class="nm-tip">The length (magnitude) of a vector.</span></a><a class="ns-method" href="vector-distance.html"><code class="nm-sig">Vector.distance(a, b) -> fixed</code><span class="nm-tip">The distance between two points.</span></a><a class="ns-method" href="vector-normalize.html"><code class="nm-sig">Vector.normalize(v) -> Vector</code><span class="nm-tip">A unit vector in the same direction.</span></a><a class="ns-method" href="vector-lerp.html"><code class="nm-sig">Vector.lerp(a, b, t) -> Vector</code><span class="nm-tip">Linear interpolation between two vectors.</span></a><a class="ns-method" href="vector-rotate.html"><code class="nm-sig">Vector.rotate(v, angle) -> Vector</code><span class="nm-tip">Rotate a vector by an angle in radians.</span></a><a class="ns-method" href="vector-angle.html"><code class="nm-sig">Vector.angle(v) -> fixed</code><span class="nm-tip">The angle of a vector in radians.</span></a><a class="ns-method" href="vector-from_angle.html"><code class="nm-sig">Vector.from_angle(a) -> Vector</code><span class="nm-tip">A unit vector pointing at an angle.</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> |