Last change
on this file since 3320 was
3320,
checked in by bensch, 19 years ago
|
orxonox/branches/parenting: curve-optimizations. Now calculation should be about 5 times faster. especially for long tracks.
|
File size:
1.5 KB
|
Rev | Line | |
---|
[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. |
---|
[3019] | 22 | |
---|
[3217] | 23 | //! Handles the curve-points (dynamic List) |
---|
[3018] | 24 | struct PathNode |
---|
| 25 | { |
---|
[3217] | 26 | int number; //!< The N-th node of this curve. |
---|
[3320] | 27 | float factor; //!< Curve specific multiplier factor. |
---|
[3217] | 28 | Vector position; //!< Vector Pointung to this curve-point. |
---|
| 29 | PathNode* next; //!< Pointer to the next Node. |
---|
[3018] | 30 | }; |
---|
| 31 | |
---|
[3217] | 32 | PathNode* firstNode; //!< First node of the curve. |
---|
| 33 | PathNode* currentNode; //!< The node we are working with (the Last node). |
---|
[3018] | 34 | |
---|
[3320] | 35 | private: |
---|
| 36 | virtual void rebuild(void) = 0; |
---|
[3019] | 37 | public: |
---|
| 38 | void addNode (const Vector& newNode); |
---|
| 39 | |
---|
| 40 | }; |
---|
| 41 | |
---|
| 42 | //! Bezier Curve |
---|
| 43 | /** |
---|
| 44 | Class to handle bezier curves in 3-dimesnsional space |
---|
| 45 | |
---|
| 46 | needed for the Tracking system in OrxOnoX. |
---|
| 47 | */ |
---|
| 48 | class BezierCurve : public Curve |
---|
| 49 | { |
---|
| 50 | private: |
---|
[3320] | 51 | void rebuild(void); |
---|
[3018] | 52 | public: |
---|
[3320] | 53 | BezierCurve(void); |
---|
| 54 | ~BezierCurve(void); |
---|
| 55 | |
---|
| 56 | Vector calcPos(float t); |
---|
| 57 | Vector calcDir(float t); |
---|
| 58 | Quaternion calcQuat(float t); |
---|
[3018] | 59 | |
---|
[3028] | 60 | |
---|
[3319] | 61 | Vector getPos(void) const; |
---|
[3018] | 62 | }; |
---|
| 63 | |
---|
[3311] | 64 | |
---|
| 65 | //! B-Spline |
---|
| 66 | /** |
---|
| 67 | class to handle b-spline in 3d space |
---|
| 68 | */ |
---|
| 69 | class BSplieCurve : public Curve |
---|
| 70 | { |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | }; |
---|
| 74 | |
---|
| 75 | |
---|
[3018] | 76 | #endif /* _CURVE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.