Explicit mechanics
Continuum primitives for a single cell. No mesh, no solver.
Symmetric tensor
vm_ is a 3×3 symmetric tensor in Voigt order (xx, yy, zz, xy, yz, zx). Shear components are tensor shear, not engineering shear, so a double contraction is a dot.
vm_/sym3_ from_ mat3 vm_pack and unpack withsym3_ to_ mat3 matrix3vm_,sym3_ add vm_sym3_ scale vm_,sym3_ deviator vm_,sym3_ hydrostatic vm_sym3_ trace vm_returnssym3_ invariants I1,J2,J3vm_sym3_pushis the push-forwardσ' = F σ Fᵀ, written back as Voigtvm_splits a velocity gradient intosym3_ dw_ split DandWvm_is the double contractionsym3_ ddot
Strain
From a deformation gradient F:
vm_isstrain_ cauchy_ green C = Fᵀ Fvm_isstrain_ green_ lagrange E = ½(C − I)vm_isstrain_ almansi e = ½(I − b⁻¹)vm_isstrain_ logarithmic ln Ufrom the stretchvm_runs polar firststrain_ logarithmic_ from_ grad vm_converts a rotation; improper matrices are rejectedstrain_ rotation_ to_ quat
A pure rotation has zero Green–Lagrange strain. ln(λ I) = ln(λ) I.
Geometry
Closest point and gap predicates. Degenerate input returns ok = false.
vm_andgeom3_ barycentric vm_geom3_ closest_ triangle vm_is signedgeom3_ point_ triangle_ gap vm_includes the parallel casegeom3_ edge_ edge vm_andgeom3_ aabb_ triangle vm_geom3_ aabb_ overlap vm_,geom3_ aabb_ contains vm_,geom3_ aabb_ union vm_geom3_ aabb_ expand vm_maps a point into an existing gridgeom3_ cell_ index vm_is the signed distance togeom3_ point_ plane dot(n, x) = offsetvm_clamps to a segmentgeom3_ closest_ segment vm_,geom3_ ray_ triangle vm_,geom3_ ray_ aabb vm_,geom3_ ray_ sphere vm_geom3_ ray_ plane vm_is a solid-ball overlapgeom3_ sphere_ sphere vm_is the intersection line; parallel planes are not a linegeom3_ plane_ plane
Batch
batch3.h is a strided scalar reference. A batch of one matches the scalar call.
vm_,batch3_ mul vm_,batch3_ inverse vm_batch3_ polar vm_is the Voigt-6 double contractionbatch3_ ddot
Strides are in elements, so packed and padded layouts both work. SIMD backends register through the existing mechanism and must match this result.
Structural scale
Folded into the physics feature. No new module.
vm_islumped_ accel a = f / mover interleaved force, per-node mass. Non-positive mass is rejected.vm_israyleigh f -= α m v + β f_int, component-wise.