next up previous
Next: Linear Spring Up: Data Structures Previous: Data Structures

Material Point

For computer representation of a material points we will use an ansi c structure which contains general informations about the point - its position, velocity and force which act on it. Ansi C Implementation of this structure is very simple:

typedef struct
    float    x,y;        // position
    float    vx,vy;      // velocity
    float    fx,fy;      // force accumulator
} CPoint2d;

As we see MP structure3 keeps information about actual position and velocity of the point. Also force accumulator have been placed here. There are vector values of course, so that is a reason why we seperated x and y values in a structure. We will rewrite all mathematical expressions seperately for x and y axis. Please note that use of c++ objects fit here very well.

Maciej Matyka 2004-03-30