next up previous
Next: Algorithm Outline Up: Data Structures Previous: Material Point

Linear Spring

For a spring we use following structure:

typedef struct
    int       i,j;        // points indexes
    float     length;     // rest length
    float     nx,ny;      // normal vector   
} CSpring;

In a CSpring structure we keep an index of first (i) and second (j) point. At a level of mesh creation we will also calculate rest length of the spring to use it in a subroutine of linear spring force calculation. Also a normal vector4 to the spring will be calculated and kept in a CSpring structure.

Maciej Matyka 2004-03-30