Alvaro Cassinelli
/
skinGames_forktest
just a test
Fork of scoreLight_Advanced by
rigidLoop.h@28:44b7b6e35548, 2012-06-19 (annotated)
- Committer:
- mbedalvaro
- Date:
- Tue Jun 19 11:22:46 2012 +0000
- Revision:
- 28:44b7b6e35548
- Parent:
- 27:1ce994629ffc
- Child:
- 30:d8af03f01cd4
version almost ready for AsahiTV;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedalvaro | 1:a4050fee11f7 | 1 | #ifndef RIGID_LOOP |
mbedalvaro | 1:a4050fee11f7 | 2 | #define RIGID_LOOP |
mbedalvaro | 1:a4050fee11f7 | 3 | |
mbedalvaro | 1:a4050fee11f7 | 4 | // Include the basic objects to create the loop |
mbedalvaro | 1:a4050fee11f7 | 5 | #include "soundSpot.h" |
mbedalvaro | 1:a4050fee11f7 | 6 | #include "classPointMass.h" // this may be used to move the center of the RIGID loop in dynamically "real" ways |
mbedalvaro | 1:a4050fee11f7 | 7 | #include "classSpring.h" // same remark than above |
mbedalvaro | 1:a4050fee11f7 | 8 | |
mbedalvaro | 1:a4050fee11f7 | 9 | using namespace std; |
mbedalvaro | 1:a4050fee11f7 | 10 | |
mbedalvaro | 28:44b7b6e35548 | 11 | enum RigidLoopMode {SPOT_FOLLOWING, SPOT_BOUNCING, SPOT_AIR_HOCKEY, SPOT_FOUNTAIN, SPOT_TEST}; |
mbedalvaro | 1:a4050fee11f7 | 12 | |
mbedalvaro | 1:a4050fee11f7 | 13 | class rigidLoop : public soundSpot { |
mbedalvaro | 1:a4050fee11f7 | 14 | |
mbedalvaro | 1:a4050fee11f7 | 15 | public: |
mbedalvaro | 1:a4050fee11f7 | 16 | |
mbedalvaro | 1:a4050fee11f7 | 17 | // Constructor and destructor: |
mbedalvaro | 1:a4050fee11f7 | 18 | rigidLoop(); |
mbedalvaro | 1:a4050fee11f7 | 19 | ~rigidLoop(); |
mbedalvaro | 1:a4050fee11f7 | 20 | |
mbedalvaro | 1:a4050fee11f7 | 21 | // instantiation of the virtual methods of the base class (we don't need to append "virtual", but for clarity I do): |
mbedalvaro | 12:0de9cd2bced5 | 22 | void createBlob(int _id, RigidLoopMode _rigidBlobMode, vector2Df _initPos, vector2Df _initSpeed); |
mbedalvaro | 12:0de9cd2bced5 | 23 | virtual void setRegionMotion(float mmix, float mmiy, float mmax, float mmay); // attention: initial position posX and posY should be inside this bounding box... |
mbedalvaro | 1:a4050fee11f7 | 24 | virtual void update(); // update dynamics of the mass loop |
mbedalvaro | 1:a4050fee11f7 | 25 | 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). |
mbedalvaro | 1:a4050fee11f7 | 26 | virtual void computeBoundingBox(); |
mbedalvaro | 1:a4050fee11f7 | 27 | virtual void sendDataSpecific(void); |
mbedalvaro | 24:4e52031a495b | 28 | virtual void speedFactor(float speedfactor); |
mbedalvaro | 1:a4050fee11f7 | 29 | |
mbedalvaro | 1:a4050fee11f7 | 30 | // methods that are new to this class (not in base class): |
mbedalvaro | 1:a4050fee11f7 | 31 | void initSizeBlob(int _numPoints); |
mbedalvaro | 1:a4050fee11f7 | 32 | void createLoopFromScafold(void); // this is much simpler than the elastic blob (here, we only need to add a central mass) |
mbedalvaro | 1:a4050fee11f7 | 33 | // void processLoopData(); // not needed, because the loop is rigid. |
mbedalvaro | 1:a4050fee11f7 | 34 | |
mbedalvaro | 1:a4050fee11f7 | 35 | RigidLoopMode updateMode; |
mbedalvaro | 1:a4050fee11f7 | 36 | |
mbedalvaro | 1:a4050fee11f7 | 37 | // 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) |
mbedalvaro | 12:0de9cd2bced5 | 38 | // int numPoints; // this belongs to soundSpot base class |
mbedalvaro | 1:a4050fee11f7 | 39 | pointMass centerMass; // this is the center of the rigidLoop. Note that it can have mass or not, this will depend on the RigidLoopMode |
mbedalvaro | 1:a4050fee11f7 | 40 | |
mbedalvaro | 1:a4050fee11f7 | 41 | // The following are common to all blobs: |
mbedalvaro | 1:a4050fee11f7 | 42 | // float angleCorrectionForceLoop; |
mbedalvaro | 1:a4050fee11f7 | 43 | // vector2D recenteringVectorLoop; |
mbedalvaro | 1:a4050fee11f7 | 44 | // float angleRecenteringVector; // auxiliary variables for sending data (for the recenteringVectorLoop) |
mbedalvaro | 1:a4050fee11f7 | 45 | // float normRecenteringVector; |
mbedalvaro | 1:a4050fee11f7 | 46 | |
mbedalvaro | 1:a4050fee11f7 | 47 | // other modes: |
mbedalvaro | 1:a4050fee11f7 | 48 | bool slidingDirection; // for contour following |
mbedalvaro | 1:a4050fee11f7 | 49 | |
mbedalvaro | 1:a4050fee11f7 | 50 | // numeric parameters: |
mbedalvaro | 1:a4050fee11f7 | 51 | float saccadeRadius; |
mbedalvaro | 1:a4050fee11f7 | 52 | |
mbedalvaro | 7:0df17f3078bc | 53 | // THINGS FOR CONTOUR FOLLOWING: |
mbedalvaro | 7:0df17f3078bc | 54 | float saccadeRadius_initial; // this is for SEARCH MODE (remember initial radius) |
mbedalvaro | 7:0df17f3078bc | 55 | bool justSearched; |
mbedalvaro | 7:0df17f3078bc | 56 | |
mbedalvaro | 7:0df17f3078bc | 57 | |
mbedalvaro | 4:f9d364f10335 | 58 | float rotationAngle; // note: in the future, rotation would be done by the openGL-like renderer |
mbedalvaro | 4:f9d364f10335 | 59 | |
mbedalvaro | 1:a4050fee11f7 | 60 | float massCenter; |
mbedalvaro | 1:a4050fee11f7 | 61 | float dampMotionCenterMass; |
mbedalvaro | 25:74cb85b85fd2 | 62 | |
mbedalvaro | 21:bc9b9383f4b6 | 63 | |
mbedalvaro | 1:a4050fee11f7 | 64 | float speedContourFollowing; // this is given as a percentage of the radius of the circle |
mbedalvaro | 1:a4050fee11f7 | 65 | float factorBouncingForce; |
mbedalvaro | 1:a4050fee11f7 | 66 | }; |
mbedalvaro | 1:a4050fee11f7 | 67 | |
mbedalvaro | 1:a4050fee11f7 | 68 | #endif |