Jello
By Angus Tsang→First New File: include/tet_cube_generator.h
generate_cube_tet_mesh() - Generates a 3D grid of vertices and subdivides each cube cell into 6 tetrahedra using a symmetric subdivision pattern. Automatically detects and fixes inverted tetrahedra by checking volume sign and swapping vertices when needed. Centers the cube at origin with bottom at y=0.
tets_to_edges() - Extracts all unique edges from the tetrahedral connectivity (6 edges per tet), with each edge becoming a spring. Adds face diagonal springs across shared tetrahedral faces for shear resistance and stability. Uses a set to prevent duplicate springs.
tets_to_surface() - Identifies boundary faces by finding faces that appear in only one tetrahedron. Preserves correct winding order for outward-facing normals, ensuring proper lighting in the renderer.
find_bottom_vertices() - Locates all vertices at minimum y-coordinate to create the “pinned” vertices that act as the plate holding the jello.
Second New File: jello_main.cpp
Replaces JSON loading with procedural generation and adds interactive features.
Physics-Based Mass Distribution - Computes tetrahedral volumes and distributes mass. Each tetrahedron contributes 1/4 of its mass to each vertex.
Shaking - Applies sinusoidal forces along the X-axis to simulate shaking. This replaces the static wind forces from the original, so it can be toggled on and off.
Acknowledgements
This code uses the mass-spring code from the original assignment 8 from CSC317.