The goal of Obj2SpringSystem is to construct a set of particles adjoined by springs to represent a simplified form of an obj.
- Simplification of obj
The main difficulty of this project is in reducing an obj into a more minimal form. By conducting cube-triangle intersections tests on a subdivided cube (2x2, 3x3, ...) which contains all the obj's vertices (cubes) and the obj's set of faces (triangles), the space which the obj occupies can be determined. These results are then written out to a file for later use.
- Ascii depiction of particle layout
The first number specifies the dimension of the cube. Following that is the set of xy slices from -z to z. The slices recreate the space occupied by the obj (1 = particle, 0 = empty).
- Recursive construction of spring system
Obj2SpringSystem reads in a file like the one above and first creates the particles at each point labeled as a '1'. The program then calls a recursive function for spring generation on one of the particles. The routine is as such:
1. Look for any adjacent particles to it
2. If particle is found, check for an existing spring between the two
3. If no existing spring, construct spring
4. Invoke the routine on that particle
This eventually fills out the system with springs. The spring framework to a 3x3 cube obj can be seen below.