Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/textEngine/src/curve.h @ 3496

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

orxonox/trunk: merged back the trackManager to the trunk.
merged with command:
svn merge -r 3369:HEAD branches/trackManager trunk
resolved conflicts in world.cc additive differences.

File size: 3.1 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  void addNode(const Vector& newNode, unsigned int insertPosition);
46  Vector getNode(unsigned int nodeToFind);
47  inline int getNodeCount(void) { return this->nodeCount;}
48
49  virtual Vector calcPos(float t) = 0;
50  virtual Vector calcDir(float t) = 0;
51  virtual Vector calcAcc(float t) = 0;
52  virtual Quaternion calcQuat(float t) = 0;
53 
54  // DEBUG
55  void debug(void);
56};
57
58//!    Class to handle bezier curves in 3-dimesnsional space
59/**
60   This Curve is good, for Fast Interaction. If you want to change it during the game, go on.
61   !!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.
62*/
63class BezierCurve : public Curve
64{
65 private:
66  void rebuild(void);
67 public:
68  BezierCurve(void);
69  BezierCurve(int derivation);
70  ~BezierCurve(void);
71  void init(void);
72
73  Vector calcPos(float t);
74  Vector calcDir(float t);
75  Vector calcAcc(float t);
76  Quaternion calcQuat(float t);
77 
78 
79  Vector getPos(void) const;
80};
81
82
83//! B-Spline
84/**
85   class to handle b-spline in 3d space
86*/
87class BSplieCurve : public Curve
88{
89
90
91};
92
93//! Uniform Point Curve-class
94/**
95   A UPoint Curve is a A Curve, that flows through all the nodes given it.
96   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.
97
98   This Curve is very erattic, so i do not recommend to use it.
99*/
100class UPointCurve : public Curve
101{
102 private:
103  void rebuild(void);
104 public:
105  UPointCurve(void);
106  UPointCurve(int derivation);
107  ~UPointCurve(void);
108  void init(void);
109
110  Vector calcPos(float t);
111  Vector calcDir(float t);
112  Vector calcAcc(float t);
113  Quaternion calcQuat(float t);
114 
115  Vector getPos(void) const;
116};
117
118#endif /* _CURVE_H */
Note: See TracBrowser for help on using the repository browser.