| Item | Choice |
|---|---|
| Handedness / axes | Right-handed, Y-up; camera looks down -Z, +X right, +Y up |
| Scalars / angles | Double, radians (Float only for GPU upload helpers) |
| Matrices | column vectors v' = M v, fields mRC, Mat4::to_col_major is GL/WebGPU/Vulkan layout |
| Quaternion | Hamilton, a * b applies b first |
| Euler | all 12 orders, intrinsic R = R_A(a) R_B(b) R_C(c), canonical branch on extraction |
| Clip / NDC depth | DepthMode: NegOneToOne (OpenGL), ZeroToOne (D3D/Vulkan/Metal/WebGPU), ReversedZ; finite or infinite far plane |
| Viewport / pixels | origin top-left, y down, pixel centres at +0.5 |
| Cube map | faces +X,-X,+Y,-Y,+Z,-Z (OpenGL table), v down; equirect u = 0.5 + atan2(x,-z)/2π |
| Spherical | azimuth 0 = -Z, +π/2 = -X; elevation from the horizon |
| Geodesy | WGS-84; ECEF → local ENU/NED → render frame (east=+X, up=+Y, north=-Z) |
model ──Rigid/Mat4 TRS──▶ world ──view (Camera)──▶ view ──Projection──▶ clip ──÷w──▶ NDC ──Viewport──▶ screen
▲ ▲ │
└─ tangent / TBN └─ convention (Z-up, Y-down, left-handed … ⇄ native) ◀── pick_ray / unproject ┘
geodetic (lat,lon,h) ⇄ ECEF ⇄ ENU/NED ⇄ render world Web-Mercator ⇄ tile / pixel / quadkey
direction ⇄ cube face (u,v) ⇄ equirect ⇄ octahedral texel ⇄ uv, wrap modes, bilinear footprint
cartesian ⇄ spherical / cylindrical / polar camera-relative (floating-origin) view matrixmoon test -p ky678/renky/system/graph # 75 tests; also --target wasm | js | native
python3 system/graph/tools/mutation_check.py # injects 71 bugs; every one must be caught
moon run system/graph/cmd/demo --target native > demo.ppm # software-rendered scene (docs/demo.png)
moon run system/graph/cmd/benchmark --target native --release # micro-benchmarkspub(all) struct Camera {
pose : Rigid
projection : Projection
viewport : Viewport
} derive(Eq, Debug)fn Camera::orbit(target : Vec3, distance : Double, yaw : Double, pitch : Double, projection : Projection, viewport : Viewport) -> Camerafn Projection::frustum(left : Double, right : Double, bottom : Double, top : Double, near : Double, far : Double, depth : DepthMode) -> Projectionfn Projection::orthographic(left : Double, right : Double, bottom : Double, top : Double, near : Double, far : Double, depth : DepthMode) -> Projectionfn Projection::orthographic_centered(width : Double, height : Double, near : Double, far : Double, depth : DepthMode) -> Projectionfn Projection::perspective(fov_y : Double, aspect : Double, near : Double, far : Double, depth : DepthMode) -> Projectionfn Projection::perspective_fov(angle_left : Double, angle_right : Double, angle_down : Double, angle_up : Double, near : Double, far : Double, depth : DepthMode) -> Projectionlet CUBE_POS_X : Intlet MERCATOR_MAX_LAT : Doublelet MERCATOR_RADIUS : Doublefn ground_resolution(lat : Double, zoom : Double, tile_size : Double) -> Doublefn mip_level_count(width : Int, height : Int) -> Intfn mod_floor(a : Int, n : Int) -> Intfn quadkey_to_tile(key : String) -> (Int, Int, Int)?fn safe_acos(x : Double) -> Doublefn safe_asin(x : Double) -> Doublefn sign_nz(x : Double) -> Doublefn tile_to_quadkey(x : Int, y : Int, zoom : Int) -> Stringfn world_size_px(zoom : Double, tile_size : Double) -> DoubleInstall
Download ziprenky: system/graph (zero-dependency coordinate systems for rendering), system/algorithms/omniring, and system/algorithms/vlab (228 numbered linear-algebra algorithms over twelve combinable inner-product spaces, 152 self-proving tests). Axiom: a self-contained finite-field skeleton plus eight ring/semiring structures, heat (tropical) degenerations, homology, and a closed computational loop. No third-party dependencies.