Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/parenting/src/curve.h @ 3320

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
Line 
1
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
15//! An abstract class to handle curves.
16class Curve
17{
18 protected:
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.
22
23  //! Handles the curve-points (dynamic List)
24  struct PathNode
25  {
26    int number;          //!< The N-th node of this curve.
27    float factor;        //!< Curve specific multiplier factor.
28    Vector position;     //!< Vector Pointung to this curve-point.
29    PathNode* next;      //!< Pointer to the next Node.
30  };
31
32  PathNode* firstNode;   //!< First node of the curve.
33  PathNode* currentNode; //!< The node we are working with (the Last node).
34
35 private:
36  virtual void rebuild(void) = 0;
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*/
48class BezierCurve : public Curve
49{
50 private:
51  void rebuild(void);
52 public:
53  BezierCurve(void);
54  ~BezierCurve(void);
55
56  Vector calcPos(float t);
57  Vector calcDir(float t);
58  Quaternion calcQuat(float t);
59 
60 
61  Vector getPos(void) const;
62};
63
64
65//! B-Spline
66/**
67   class to handle b-spline in 3d space
68*/
69class BSplieCurve : public Curve
70{
71
72
73};
74
75
76#endif /* _CURVE_H */
Note: See TracBrowser for help on using the repository browser.