{
 "id": "4d-stereographic-projection-turning",
 "title": "Pole-Safe 4D Stereographic Projection & Discrete-Cell Rotations",
 "aliases": [
  "4D stereographic ray marching",
  "tesseract stereographic projection",
  "S3 polytope projection"
 ],
 "domain": "geometry",
 "subdomain": "higher-dimensional geometry & SDFs",
 "stage": "geometry",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu"
 ],
 "year_introduced": 1992,
 "inputs": [
  "sdf",
  "material-params"
 ],
 "outputs": [
  "radiance",
  "depth",
  "normals"
 ],
 "style": "stylized",
 "dynamic": "dynamic",
 "summary": "Projects 4D polytopes living on the unit 3-sphere S3 into 3D space via conformal stereographic projection, using symmetry folding and pole-safe distance bounds so 4D rotations turn cells inside out without tessellation blowups.",
 "how_it_works": "A 4D polytope such as a tesseract (`8-cell`) or `24-cell` can be normalized onto the unit 3-sphere `S^3 ⊂ R^4`, turning straight 4D edges into great-circle arcs. Rotating it with an orthogonal `SO(4)` matrix across the six 4D coordinate planes (`XY, XZ, YZ, XW, YW, ZW`) turns inner and outer 3D cells smoothly inside out.\n\n**Stereographic projection** maps `(x, y, z, w) ∈ S^3` from the north pole `(0, 0, 0, 1)` to `R^3` via `p = (x, y, z) / (1 - w)`. Because the map is conformal, great-circle edges arrive in 3D as exact circular arcs or lines. Instead of tessellating arcs that stretch unboundedly near `w → 1`, a **ray-marched SDF** lifts each 3D sample `p` back to `S^3` via `q = (2p, |p|^2 - 1) / (|p|^2 + 1)`, applies the inverse `SO(4)` rotation, and folds coordinates by the polytope's discrete symmetry group, collapsing 32 edges and 16 vertices into a few primitive tests.\n\nA **pole-safe step bound** scales spherical distance by the local inverse Jacobian `(|p|^2 + 1) / 2` and computes chords via squared differences `|a - b|^2` to avoid float32 cancellation.",
 "when_to_use": "Choose it when rendering smooth, curved 4D polytopes, Hopf fibrations, or inside-out hypercube animations where exact circular edges and real-time 4D rotations matter.\n\nPrefer [sphere-tracing](sphere-tracing) on standard 3D Euclidean SDFs when no non-Euclidean projection distortion is needed. Prefer explicit 4D-to-3D perspective wireframes or sliced cross-section meshes when you need rasterized triangle geometry or physical 3D-printable models.",
 "cost": {
  "class": "medium",
  "notes": "Full-screen per-pixel ray marching with symmetry-folded inverse stereographic SDF evaluation typically runs in 1–3 ms at 1080p on mid-range desktop GPUs, scaling with pixel count and march iterations."
 },
 "failure_modes": [
  "Geometry passing directly through the projection pole (w → 1) expands toward infinity, requiring pole-safe clamping or discrete-cell rotation framing to avoid screen-filling tubes",
  "Evaluating chord distances via 2 - 2*cos(theta) suffers catastrophic float32 cancellation on distant thin arcs unless rewritten as sums of squared differences",
  "Conformal scale inflation causes Euclidean step sizes to overshoot far from the origin if the inverse Jacobian factor is omitted",
  "Inside-out turning can invert visual depth cues unless shading, ambient occlusion, or color gradients distinguish W-depth"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1109/38.144827",
   "type": "paper",
   "title": "Illuminating the fourth dimension",
   "authors": [
    "Andrew J. Hanson",
    "Pheng A. Heng"
   ],
   "year": 1992,
   "venue": "IEEE Computer Graphics and Applications",
   "url": "https://doi.org/10.1109/38.144827",
   "ids": {
    "doi": "10.1109/38.144827"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.144827",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.144827",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.144827",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.144827",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1109/38.144827",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": 1,
   "__bib": "hanson1992illuminating"
  },
  {
   "role": "secondary",
   "key": "doi:10.1109/visual.1991.175821",
   "type": "paper",
   "title": "Visualizing the fourth dimension using geometry and light",
   "authors": [
    "A.J. Hanson",
    "P.A. Heng"
   ],
   "year": null,
   "venue": "Proceeding Visualization '91",
   "url": "https://doi.org/10.1109/visual.1991.175821",
   "ids": {
    "doi": "10.1109/visual.1991.175821"
   },
   "license": null,
   "extra": {
    "csl_type": "proceedings-article"
   },
   "provenance": {
    "title": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1109/visual.1991.175821 (CSL-JSON)",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1109/visual.1991.175821 (CSL-JSON)",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1109/visual.1991.175821 (CSL-JSON)",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1109/visual.1991.175821 (CSL-JSON)",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "doi.org",
     "endpoint": "https://doi.org/10.1109/visual.1991.175821 (CSL-JSON)",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": 1,
   "__bib": "hansonvisualizing"
  },
  {
   "role": "implementation",
   "key": "gh:acher249/codevember-2026",
   "type": "code",
   "title": "acher249/codevember-2026",
   "description": "#codevember ",
   "authors": [
    "acher249"
   ],
   "year": 2026,
   "venue": "GitHub",
   "url": "https://github.com/acher249/codevember-2026",
   "ids": {
    "repo": "acher249/codevember-2026"
   },
   "license": "MIT",
   "extra": {
    "stars": 133,
    "stars_checked": "2026-11-30",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-11-29T23:19:53Z",
    "language": "TypeScript",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/acher249/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/acher249/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/acher249/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/acher249/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/acher249/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/acher249/codevember-2026",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": null,
   "__bib": "acher2026acher249"
  }
 ],
 "presets": [],
 "related": [
  "sphere-tracing",
  "enhanced-sphere-tracing",
  "cube-sphere-mapping",
  "sdf-csg-smooth-min"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "sphere-tracing",
   "why": "Advances camera rays through the inverse-stereographic Jacobian-bounded SDF to render exact curved 4D arcs without mesh subdivision."
  },
  {
   "id": "sdf-csg-smooth-min",
   "why": "Smoothly joins projected 4D vertices, metaballs, or fractal joints onto the circular edge arcs."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-30T17:59:51.239Z",
  "draft": "data/drafts/geometry/4d-stereographic-projection-turning.json"
 },
 "solves": [
  "visualize 4d polytopes tesseracts or hyperspheres rotating in 3d",
  "avoid flat orthographic crushing when projecting 4d shapes to 3d",
  "render smooth inside-out 4d torus turning and Clifford tori animations",
  "preserve angles and spherical curvature when mapping 4d points to 3d space",
  "build an interactive 4d geometry explorer with intuitive depth cues"
 ],
 "authority": "Hanson & Heng, 1992",
 "url": "https://texelatlas.vercel.app/t/4d-stereographic-projection-turning/",
 "execution_fidelity": "none",
 "fidelity_label": "No Live Specimen",
 "benchmark_eligible": false
}