home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks96 / FinderFlocks.sit / FinderFlocks / CParticle.h < prev    next >
C/C++ Source or Header  |  1996-06-22  |  1KB  |  28 lines

  1. #pragma once    // prevents multiple inclusions
  2.  
  3. /*  This class implements a simple ballistic particle in 2D with position, velocity,
  4.     and acceleration (all of which are "Fixed point Points"). The velocity and 
  5.     acceleration are treated as 2D vectors, and their units are pixels per frame and
  6.     pixels per frame per frame, respectively. This conveniently eliminates mass 
  7.     considerations in the math. The reason I do this is 'cuz it's faster. There are only
  8.     three routines: InitParticle, which sets the values of the variables; NextStep, which
  9.     moves the particle a time step of 1, calculating the new position and velocity; and 
  10.     Step, which takes an integer and moves that many steps. Note that there are no
  11.     drawing routines, and that all three variables are available only to subclasses. */
  12.  
  13. #include    "FlockTypes.h"
  14.         
  15. class CParticle
  16. {
  17. protected:    
  18.     FloatPoint        fPosition;
  19.     FloatPoint        fVelocity;
  20.     FloatPoint         fAcceleration;
  21.  
  22.     CParticle    *InitParticle(FloatPoint *ipos, FloatPoint *ivel, FloatPoint *iaccel);
  23.     
  24.     // Stepping functions
  25.     void         NextStep(void);
  26.     void         Step(short steps);
  27. };  // size = 24 bytes
  28.