Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/trackManager/src/curve.h @ 3374

Last change on this file since 3374 was 3374, checked in by bensch, 20 years ago

orxonox/branches/trackManager: deleted old track-system

File size: 3.0 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//! An Enumerator that defines what sort of Curves are availible
15enum CurveType {BEZIERCURVE, UPOINTCURVE};
16
17
18//! An abstract class to handle curves. Needed for the Tracking system in orxonox.
19class Curve
20{
21 protected:
22  int nodeCount;         //!< The count of nodes the Curve has.
23  Vector curvePoint;     //!< The point on the Cureve at a local Time.
24  float localTime;       //!< If the time of one point is asked more than once the programm will not calculate it again.
25  int derivation;        //!< Which derivation of a Curve is this.
26
27  //! Handles the curve-points (dynamic List)
28  struct PathNode
29  {
30    int number;          //!< The N-th node of this curve.
31    float factor;        //!< Curve specific multiplier factor.
32    Vector vFactor;      //!< A Vector-factor for multipliing.
33    Vector position;     //!< Vector Pointung to this curve-point.
34    PathNode* next;      //!< Pointer to the next Node.
35  };
36
37  PathNode* firstNode;   //!< First node of the curve.
38  PathNode* currentNode; //!< The node we are working with (the Last node).
39
40 private:
41  virtual void rebuild(void) = 0;
42 public:
43  Curve* dirCurve;       //!< The derivation-curve of this Curve.
44  void addNode(const Vector& newNode);
45  Vector getNode(unsigned int nodeToFind);
46  inline int getNodeCount(void) { return this->nodeCount;}
47
48  virtual Vector calcPos(float t) = 0;
49  virtual Vector calcDir(float t) = 0;
50  virtual Vector calcAcc(float t) = 0;
51  virtual Quaternion calcQuat(float t) = 0;
52 
53};
54
55//!    Class to handle bezier curves in 3-dimesnsional space
56/**
57   This Curve is good, for Fast Interaction. If you want to change it during the game, go on.
58   !!be aware!! BezierCurves only flow through their first and last Node. Their Tangents at those Points a directed to the second and second-last Point.
59*/
60class BezierCurve : public Curve
61{
62 private:
63  void rebuild(void);
64 public:
65  BezierCurve(void);
66  BezierCurve(int derivation);
67  ~BezierCurve(void);
68  void init(void);
69
70  Vector calcPos(float t);
71  Vector calcDir(float t);
72  Vector calcAcc(float t);
73  Quaternion calcQuat(float t);
74 
75 
76  Vector getPos(void) const;
77};
78
79
80//! B-Spline
81/**
82   class to handle b-spline in 3d space
83*/
84class BSplieCurve : public Curve
85{
86
87
88};
89
90//! Uniform Point Curve-class
91/**
92   A UPoint Curve is a A Curve, that flows through all the nodes given it.
93   The Algorithm to buid the curve is rather slow, but Painting and tracing along the curve has high speed, so do not change this curve during the Game.
94
95   This Curve is very erattic, so i do not recommend to use it.
96*/
97class UPointCurve : public Curve
98{
99 private:
100  void rebuild(void);
101 public:
102  UPointCurve(void);
103  UPointCurve(int derivation);
104  ~UPointCurve(void);
105  void init(void);
106
107  Vector calcPos(float t);
108  Vector calcDir(float t);
109  Vector calcAcc(float t);
110  Quaternion calcQuat(float t);
111 
112  Vector getPos(void) const;
113};
114
115#endif /* _CURVE_H */
Note: See TracBrowser for help on using the repository browser.