Last change
on this file since 3242 was
3217,
checked in by bensch, 20 years ago
|
orxonox/trunk: copied Curve-class from branches/bezierCurve. The only really useable Class from there.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[3018] | 1 | /*! |
---|
| 2 | \file curve.h |
---|
| 3 | \brief A basic 3D curve framework |
---|
| 4 | |
---|
| 5 | Contains classes to handle curves |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #ifndef _CURVE_H |
---|
| 9 | #define _CURVE_H |
---|
| 10 | |
---|
| 11 | #include "vector.h" |
---|
| 12 | |
---|
| 13 | |
---|
[3217] | 14 | //! An abstract class to handle curves. |
---|
[3019] | 15 | class Curve |
---|
[3018] | 16 | { |
---|
[3019] | 17 | protected: |
---|
[3217] | 18 | int nodeCount; //!< The count of nodes the Curve has. |
---|
| 19 | Vector curvePoint; //!< The point on the Cureve at a local Time. |
---|
| 20 | float localTime; //!< If the time of one point is asked more than once the programm will not calculate it again. |
---|
[3019] | 21 | |
---|
[3217] | 22 | //! Handles the curve-points (dynamic List) |
---|
[3018] | 23 | struct PathNode |
---|
| 24 | { |
---|
[3217] | 25 | int number; //!< The N-th node of this curve. |
---|
| 26 | Vector position; //!< Vector Pointung to this curve-point. |
---|
| 27 | PathNode* next; //!< Pointer to the next Node. |
---|
[3018] | 28 | }; |
---|
| 29 | |
---|
[3217] | 30 | PathNode* firstNode; //!< First node of the curve. |
---|
| 31 | PathNode* currentNode; //!< The node we are working with (the Last node). |
---|
[3018] | 32 | |
---|
[3019] | 33 | public: |
---|
| 34 | void addNode (const Vector& newNode); |
---|
| 35 | |
---|
| 36 | }; |
---|
| 37 | |
---|
| 38 | //! Bezier Curve |
---|
| 39 | /** |
---|
| 40 | Class to handle bezier curves in 3-dimesnsional space |
---|
| 41 | |
---|
| 42 | needed for the Tracking system in OrxOnoX. |
---|
| 43 | */ |
---|
| 44 | class BezierCurve : public Curve |
---|
| 45 | { |
---|
| 46 | private: |
---|
| 47 | // all from Curve-Class |
---|
[3018] | 48 | public: |
---|
| 49 | BezierCurve (void); |
---|
| 50 | ~BezierCurve (void); |
---|
[3028] | 51 | Vector calcPos (float t); |
---|
| 52 | Vector calcDir (float t); |
---|
| 53 | Quaternion calcQuat (float t); |
---|
[3018] | 54 | |
---|
[3028] | 55 | |
---|
[3018] | 56 | Vector getPos () const; |
---|
| 57 | }; |
---|
| 58 | |
---|
[3019] | 59 | int ncr(int n, int i); |
---|
[3018] | 60 | |
---|
| 61 | |
---|
| 62 | #endif /* _CURVE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.