Last change
on this file since 3345 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
|
Line | |
---|
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 | |
---|
14 | //! An abstract class to handle curves. |
---|
15 | class Curve |
---|
16 | { |
---|
17 | protected: |
---|
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. |
---|
21 | |
---|
22 | //! Handles the curve-points (dynamic List) |
---|
23 | struct PathNode |
---|
24 | { |
---|
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. |
---|
28 | }; |
---|
29 | |
---|
30 | PathNode* firstNode; //!< First node of the curve. |
---|
31 | PathNode* currentNode; //!< The node we are working with (the Last node). |
---|
32 | |
---|
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 |
---|
48 | public: |
---|
49 | BezierCurve (void); |
---|
50 | ~BezierCurve (void); |
---|
51 | Vector calcPos (float t); |
---|
52 | Vector calcDir (float t); |
---|
53 | Quaternion calcQuat (float t); |
---|
54 | |
---|
55 | |
---|
56 | Vector getPos () const; |
---|
57 | }; |
---|
58 | |
---|
59 | int ncr(int n, int i); |
---|
60 | |
---|
61 | |
---|
62 | #endif /* _CURVE_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.