{
 "id": "rotation-minimizing-frames",
 "title": "Rotation-Minimizing Frames",
 "aliases": [],
 "domain": "geometry",
 "subdomain": "curve sweeps",
 "stage": "geometry",
 "realtime": "realtime",
 "platforms": [
  "cpu",
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "blender",
  "unity"
 ],
 "year_introduced": 2008,
 "inputs": [
  "curves"
 ],
 "outputs": [
  "mesh",
  "normals"
 ],
 "style": "both",
 "dynamic": "both",
 "summary": "Builds a frame (tangent, normal, binormal) along a 3D curve that twists as little as possible, so tubes, ribbons and sweeps do not flip or spin. Computed with the double-reflection method.",
 "how_it_works": "The Frenet frame uses curvature direction as the normal, which flips at inflection points and is undefined on straight segments. A rotation-minimizing frame keeps the normal as close to parallel transport as possible. The double reflection method does this iteratively from sampled points: given frame i with tangent t_i and normal r_i, reflect through the plane perpendicular to the chord between point i and i+1, then reflect again through the plane that maps the reflected tangent to the next tangent. The two reflections yield r_{i+1} with almost no extra twist and fourth-order accuracy. Closed curves need a residual twist correction distributed along the curve so the end frame matches the start. Sweeping a profile along these frames produces tubes and extrusions.",
 "when_to_use": "Choose it for tubes, cables, roads, plant stems and camera paths along a spline where you want stable orientation. Prefer a Frenet frame only for planar curves with consistent curvature, and an explicit up-vector or user-set twist keyframes when the artist needs control of roll, such as roller coaster rails.",
 "cost": {
  "class": "cheap",
  "notes": "Constant work per sample point; two reflections."
 },
 "failure_modes": [
  "Parallel transport accumulates twist on closed curves, leaving a seam unless corrected",
  "Frames are path-dependent: reversing the curve gives different frames",
  "Coarse sampling at high curvature loses accuracy",
  "Cannot satisfy a required roll such as a banked rail without a twist function"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1145/1330511.1330513",
   "type": "paper",
   "title": "Computation of rotation minimizing frames",
   "authors": [
    "Wenping Wang",
    "Bert Jüttler",
    "Dayue Zheng",
    "Yang Liu"
   ],
   "year": 2008,
   "venue": "ACM Transactions on Graphics",
   "url": "https://doi.org/10.1145/1330511.1330513",
   "ids": {
    "doi": "10.1145/1330511.1330513"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1330511.1330513",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1330511.1330513",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1330511.1330513",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1330511.1330513",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1145/1330511.1330513",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": 1,
   "__bib": "wang2008computation"
  },
  {
   "role": "implementation",
   "key": "gh:mrdoob/three.js",
   "type": "code",
   "title": "mrdoob/three.js",
   "description": "JavaScript 3D Library.",
   "authors": [
    "mrdoob"
   ],
   "year": 2010,
   "venue": "GitHub",
   "url": "https://github.com/mrdoob/three.js",
   "ids": {
    "repo": "mrdoob/three.js"
   },
   "license": "MIT",
   "extra": {
    "stars": 119718,
    "stars_checked": "2026-11-29",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-11-29T11:39:51Z",
    "language": "JavaScript",
    "homepage": "https://threejs.org/",
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/mrdoob/three.js",
     "checked_at": "2026-11-29T15:51:27.588Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-29T15:51:27.588Z",
   "title_sim": null,
   "__bib": "mrdoob2010mrdoob"
  }
 ],
 "presets": [
  {
   "id": "rotation-minimizing-frames-specimen",
   "title": "Rotation-minimizing frames (left) vs Frenet normals (right) along a space curve",
   "runtime": "glsl-fragment",
   "params": {
    "STEPS": 56,
    "RIB": 0.07
   },
   "code": "// Frames along a space curve (orthographic view): left = double-reflection rotation-minimizing frame, right = Frenet normals.\nconst int STEPS = 56;\nconst float RIB = 0.07;\nvec3 curve(float s) { return vec3(cos(s), sin(s), 0.55 * sin(3.0 * s)); }\nvec3 tang(float s) { return normalize(vec3(-sin(s), cos(s), 1.65 * cos(3.0 * s))); }\nvec3 acc(float s) { return vec3(-cos(s), -sin(s), -4.95 * sin(3.0 * s)); }\nvec2 proj(vec3 p) { return vec2(p.x * 0.866 - p.y * 0.5, p.z * 0.9 + (p.x * 0.5 + p.y * 0.866) * 0.45); }\nfloat segd(vec2 p, vec2 a, vec2 b) {\n    vec2 pa = p - a, ba = b - a;\n    return length(pa - ba * clamp(dot(pa, ba) / max(dot(ba, ba), 1e-6), 0.0, 1.0));\n}\nvoid mainImage(out vec4 fragColor, in vec2 fragCoord) {\n    vec2 uv = fragCoord / iResolution.xy;\n    bool R = uv.x < 0.5;\n    vec2 q = (vec2(fract(uv.x * 2.0), uv.y) - 0.5) * 3.0 * vec2(1.0, 1.0) / 1.25;\n    float dc = 1e9, dr = 1e9; float hue = 0.0;\n    vec3 x0 = curve(0.0), t0 = tang(0.0);\n    vec3 r0 = normalize(cross(t0, vec3(0, 0, 1)));\n    vec2 prev = proj(x0);\n    for (int i = 1; i <= STEPS; i++) {\n        float s = 6.2831853 * float(i) / float(STEPS);\n        vec3 x1 = curve(s), t1 = tang(s);\n        vec3 v1 = x1 - x0; float c1 = dot(v1, v1);\n        vec3 rL = r0 - (2.0 / c1) * dot(v1, r0) * v1, tL = t0 - (2.0 / c1) * dot(v1, t0) * v1;\n        vec3 v2 = t1 - tL; float c2 = dot(v2, v2);\n        vec3 r1 = c2 > 1e-9 ? rL - (2.0 / c2) * dot(v2, rL) * v2 : rL;\n        vec3 a = acc(s); vec3 nf = normalize(a - dot(a, t1) * t1);\n        vec3 nn = R ? r1 : nf;\n        vec2 p1 = proj(x1);\n        dc = min(dc, segd(q, prev, p1));\n        float dd = segd(q, p1 - proj(nn * RIB), p1 + proj(nn * RIB));\n        if (dd < dr) { dr = dd; hue = float(i) / float(STEPS); }\n        prev = p1; x0 = x1; t0 = t1; r0 = r1;\n    }\n    vec3 col = vec3(0.05, 0.06, 0.09) + 0.03 * uv.y;\n    col = mix(col, vec3(0.8), smoothstep(0.012, 0.006, dc));\n    vec3 rc = 0.5 + 0.5 * cos(6.2831 * (hue + vec3(0.0, 0.33, 0.67)));\n    col = mix(col, rc, smoothstep(0.009, 0.005, dr));\n    col = mix(col, vec3(1.0), smoothstep(0.003, 0.0, abs(uv.x - 0.5)));\n    fragColor = vec4(pow(col, vec3(0.8)), 1.0);\n}\n",
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "conceptual-diagram",
   "proof": {
    "kind": "rendered",
    "label": "rendered 2026-11-29",
    "ok": true,
    "proof": {
     "ok": true,
     "technique": "rotation-minimizing-frames",
     "runtime": "glsl-fragment",
     "checked_at": "2026-11-29T15:51:50.471Z",
     "renderer": "Chromium 145.0.7632.6 headless, WebGL2 via ANGLE/SwiftShader, 512×512, iTime=1.5",
     "stats": {
      "mean": 0.1496,
      "std": 0.1182,
      "unique_colors": 205
     },
     "image": "/specimens/rotation-minimizing-frames-specimen.webp",
     "reason": null
    }
   }
  }
 ],
 "related": [
  "geometry-images"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "marching-cubes",
   "why": "Sweep tubes into a volume or SDF and re-mesh with marching cubes for unions of tubes."
  },
  {
   "id": "catmull-clark-subdivision",
   "why": "The swept tube grid can be a subdivision cage."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-29T15:51:27.588Z",
  "draft": "data/drafts/geometry/rotation-minimizing-frames.json"
 },
 "solves": [
  "tube or ribbon along a curve twists or flips",
  "cables and roads spin unexpectedly along splines",
  "camera on a path rolls unpredictably",
  "need stable orientation for sweeping geometry along a curve"
 ],
 "authority": "Wang et al., 2008",
 "url": "https://texelatlas.vercel.app/t/rotation-minimizing-frames/",
 "execution_fidelity": "conceptual-diagram",
 "fidelity_label": "Visual Diagram",
 "benchmark_eligible": false,
 "gpu_weight": {
  "weight_x": 47.85,
  "tier": "heavy",
  "p50_ms": 1.5742,
  "p95_ms": 1.7003,
  "baseline_p50_ms": 0.0329,
  "gpu": "Tesla T4/PCIe/SSE2",
  "resolution": "1920x1080",
  "method": "opengl-timer-query",
  "frames": 40,
  "preset_id": "rotation-minimizing-frames-specimen",
  "execution_fidelity": "conceptual-diagram",
  "fidelity_label": "Visual Diagram",
  "benchmark_eligible": false,
  "generated_at": "2026-11-30T21:07:47Z",
  "l4": {
   "weight_x": 35.58,
   "tier": "heavy",
   "p50_ms": 0.5658,
   "p95_ms": 0.5844,
   "speedup_x": 2.78,
   "gpu": "NVIDIA L4/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0159
  },
  "a100": {
   "weight_x": 27.54,
   "tier": "heavy",
   "p50_ms": 0.7931,
   "p95_ms": 0.7936,
   "speedup_x": 1.98,
   "gpu": "NVIDIA A100-SXM4-40GB/PCIe/SSE2",
   "resolution": "1920x1080",
   "baseline_p50_ms": 0.0288
  }
 }
}