[3311] | 1 | |
---|
[3018] | 2 | /*! |
---|
| 3 | \file curve.h |
---|
| 4 | \brief A basic 3D curve framework |
---|
| 5 | |
---|
| 6 | Contains classes to handle curves |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #ifndef _CURVE_H |
---|
| 10 | #define _CURVE_H |
---|
| 11 | |
---|
| 12 | #include "vector.h" |
---|
| 13 | |
---|
| 14 | |
---|
[3217] | 15 | //! An abstract class to handle curves. |
---|
[3019] | 16 | class Curve |
---|
[3018] | 17 | { |
---|
[3019] | 18 | protected: |
---|
[3217] | 19 | int nodeCount; //!< The count of nodes the Curve has. |
---|
| 20 | Vector curvePoint; //!< The point on the Cureve at a local Time. |
---|
| 21 | float localTime; //!< If the time of one point is asked more than once the programm will not calculate it again. |
---|
[3321] | 22 | Curve* dirCurve; //!< The derivation-curve of this Curve. |
---|
| 23 | int derivation; //!< Which derivation of a Curve is this. |
---|
[3019] | 24 | |
---|
[3217] | 25 | //! Handles the curve-points (dynamic List) |
---|
[3018] | 26 | struct PathNode |
---|
| 27 | { |
---|
[3217] | 28 | int number; //!< The N-th node of this curve. |
---|
[3320] | 29 | float factor; //!< Curve specific multiplier factor. |
---|
[3217] | 30 | Vector position; //!< Vector Pointung to this curve-point. |
---|
| 31 | PathNode* next; //!< Pointer to the next Node. |
---|
[3018] | 32 | }; |
---|
| 33 | |
---|
[3217] | 34 | PathNode* firstNode; //!< First node of the curve. |
---|
| 35 | PathNode* currentNode; //!< The node we are working with (the Last node). |
---|
[3018] | 36 | |
---|
[3320] | 37 | private: |
---|
| 38 | virtual void rebuild(void) = 0; |
---|
[3019] | 39 | public: |
---|
| 40 | void addNode (const Vector& newNode); |
---|
| 41 | |
---|
[3322] | 42 | virtual Vector calcPos(float t) = 0; |
---|
| 43 | virtual Vector calcDir(float t) = 0; |
---|
| 44 | virtual Quaternion calcQuat(float t) = 0; |
---|
| 45 | |
---|
[3019] | 46 | }; |
---|
| 47 | |
---|
| 48 | //! Bezier Curve |
---|
| 49 | /** |
---|
| 50 | Class to handle bezier curves in 3-dimesnsional space |
---|
| 51 | |
---|
| 52 | needed for the Tracking system in OrxOnoX. |
---|
| 53 | */ |
---|
| 54 | class BezierCurve : public Curve |
---|
| 55 | { |
---|
| 56 | private: |
---|
[3320] | 57 | void rebuild(void); |
---|
[3018] | 58 | public: |
---|
[3320] | 59 | BezierCurve(void); |
---|
[3321] | 60 | BezierCurve(int derivation); |
---|
[3320] | 61 | ~BezierCurve(void); |
---|
[3321] | 62 | void init(void); |
---|
[3320] | 63 | |
---|
| 64 | Vector calcPos(float t); |
---|
| 65 | Vector calcDir(float t); |
---|
| 66 | Quaternion calcQuat(float t); |
---|
[3018] | 67 | |
---|
[3028] | 68 | |
---|
[3319] | 69 | Vector getPos(void) const; |
---|
[3018] | 70 | }; |
---|
| 71 | |
---|
[3311] | 72 | |
---|
| 73 | //! B-Spline |
---|
| 74 | /** |
---|
| 75 | class to handle b-spline in 3d space |
---|
| 76 | */ |
---|
| 77 | class BSplieCurve : public Curve |
---|
| 78 | { |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | }; |
---|
| 82 | |
---|
| 83 | |
---|
[3018] | 84 | #endif /* _CURVE_H */ |
---|