One-Page Cheat Sheet for the Math Layer
Geometry = State(Mutation)
= MatrixStack.apply(GeometricOperation)
State: WHERE and HOW → Transforms, scopes, platforms
Mutation: WHAT → Primitives, CSG, deformations
Y = normalize(N)
X = normalize(cross(Up, Y)) # guard singularity
Z = cross(X, Y)
M = [X | Y | Z | P] # 4×4 affine
M_reflect = P × S × P⁻¹
where:
P = platform world matrix
S = diag(-1,1,1,1) for X-axis flip
push(): stack.append(copy(top))
pop(): stack.pop()
transform(T): top = top × T
| Symbol | Type | Effect |
|---|---|---|
T(v) |
State | Translate by v |
R(axis, θ) |
State | Rotate θ around axis |
S(v) |
State | Scale by v |
[ ] |
State | Push/Pop scope |
Platform(P) |
State | Set portable world center |
Align(p, n) |
State | Gram-Schmidt to surface |
Mirror(axis) |
Flow | Bifurcate: real + reflected |
Radial(n) |
Flow | Replicate n times rotated |
Instance(mesh) |
Mutation | Emit geometry |
□ ○ △ |
Mutation | Primitives |
⊕ ⊖ ⊗ |
Mutation | CSG ops |
def execute(node, state):
node.exec_self(state) # Apply this node's effect
for child in node.children:
child.execute(state) # RecurseMirror Node (bifurcation):
# PATH A: real
for child in children: child.execute(state)
# PATH B: reflected
state.push()
state.M = state.M @ platform_reflect(P, axis)
for child in children: child.execute(state)
state.pop()Sequential: A ∘ B = A × B
Scoped: [ A ] isolates A's effects
Inverse: (A × B)⁻¹ = B⁻¹ × A⁻¹
Associative: (A × B) × C = A × (B × C)
NOT Commutative: A × B ≠ B × A
root:
- Platform: { id: "P1" }
- Mirror: { axis: X }
children:
- T: { v: [100, 0, 0] }
- Instance: { mesh: "Arm" }↓ compiles to ↓
Root
└─ Platform("P1")
└─ Mirror(X)
└─ Translate([100,0,0])
└─ Instance("Arm")
state.buffer = [
{ geometry: "Arm", transform: M1, sym_depth: 0 }, # Real
{ geometry: "Arm", transform: M2, sym_depth: 1 }, # Reflected
]- All transforms are 4×4 affine matrices
- Composition = matrix multiplication (right-to-left)
- Push/Pop isolates scope
- Platform reflection:
M = P × S × P⁻¹ - Gram-Schmidt produces orthonormal bases
- System is closed under composition
3D_tools_ML_hybrid/
├── core/
│ ├── SKELETAL_SINGLETON_TREE.md ← Architecture overview
│ ├── math_foundations.md ← Gram-Schmidt, reflection algebra
│ ├── node_algebra.md ← Functional alphabet, composition
│ ├── state_schema.md ← Matrix stack details
│ ├── mutation_schema.md ← Geometry operations
│ └── transpiler_spec.md ← Maya/Blender/Unreal mappings
└── index.jsonl ← Machine-readable index
This math layer plugs into any program logic. The structure IS the code.