Alvaro Cassinelli
/
skinGames_forktest
just a test
Fork of scoreLight_Advanced by
Diff: rigidLoop.h
- Revision:
- 1:a4050fee11f7
- Child:
- 4:f9d364f10335
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rigidLoop.h Sat Mar 31 08:19:31 2012 +0000 @@ -0,0 +1,59 @@ +#ifndef RIGID_LOOP +#define RIGID_LOOP + +// Include the basic objects to create the loop +#include "soundSpot.h" +#include "classPointMass.h" // this may be used to move the center of the RIGID loop in dynamically "real" ways +#include "classSpring.h" // same remark than above + +using namespace std; + +enum RigidLoopMode {SPOT_FOLLOWING, SPOT_BOUNCING}; + +class rigidLoop : public soundSpot { + +public: + + // Constructor and destructor: + rigidLoop(); + ~rigidLoop(); + + // instantiation of the virtual methods of the base class (we don't need to append "virtual", but for clarity I do): + void createBlob(int _id, RigidLoopMode _rigidBlobMode, vector2D _initPos); + virtual void setRegionMotion(int mmix, int mmiy, int mmax, int mmay); // attention: initial position posX and posY should be inside this bounding box... + virtual void update(); // update dynamics of the mass loop + virtual void draw(void); // draw the blob (renders on the laser trajectory object lsdTrajectory from the base class, using the openGL laser renderer - not yet done). + virtual void computeBoundingBox(); + virtual void sendDataSpecific(void); + + // methods that are new to this class (not in base class): + void initSizeBlob(int _numPoints); + void createLoopFromScafold(void); // this is much simpler than the elastic blob (here, we only need to add a central mass) + // void processLoopData(); // not needed, because the loop is rigid. + + RigidLoopMode updateMode; + + // The number of points in the loop (in this case, is just the number of points in the scaffold, as well as the number of points in the lsdTrajectory) + int numPoints; + pointMass centerMass; // this is the center of the rigidLoop. Note that it can have mass or not, this will depend on the RigidLoopMode + + // The following are common to all blobs: + // float angleCorrectionForceLoop; + // vector2D recenteringVectorLoop; + // float angleRecenteringVector; // auxiliary variables for sending data (for the recenteringVectorLoop) + // float normRecenteringVector; + + // other modes: + bool slidingDirection; // for contour following + + // numeric parameters: + float saccadeRadius; + + float massCenter; + float dampMotionCenterMass; + + float speedContourFollowing; // this is given as a percentage of the radius of the circle + float factorBouncingForce; +}; + +#endif \ No newline at end of file