예제 #1
0
 //Algorithm specific per-frame calculations
 void perFrame()
 {
     fptr++;
     clearForces();
     for (int i = 0; i < _lattice.Length; i++)
     {
         cMass ptr = _lattice[i];
         ptr.calcCons();   //calculate addition of all the forces
         ptr.doMovement(); //move according to time and calculated force, includes collision detection
     }
 }
예제 #2
0
    //Algorithm specific per-frame calculations
    void perFrame()
    {
        fptr++;
        clearForces();

        //First calculate midpoint
        for (int i = 0; i < _lattice.Length; i++)
        {
            cMass ptr = _lattice[i];
            ptr.calcCons_h();             //calculate addition of all the forces
            ptr.doMovement_h();           //move according to time and calculated force, includes collision detection
        }

        //Then calculate over the midpoint to achieve final point
        for (int i = 0; i < _lattice.Length; i++)
        {
            cMass ptr = _lattice[i];
            ptr.calcCons();             //calculate addition of all the forces
            ptr.doMovement();           //move according to time and calculated force, includes collision detection
        }
    }