Changeset 4472 in orxonox.OLD for orxonox/trunk/src/lib/math
- Timestamp:
- Jun 2, 2005, 2:12:23 AM (19 years ago)
- Location:
- orxonox/trunk/src/lib/math
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/math/curve.cc
r3595 r4472 64 64 } 65 65 66 /** 67 \brief adds a new Node to the bezier Curve 68 \param newNode a Vector to the position of the new node 69 \param insertPosition after the n-th node the new node will be inserted 70 */ 66 71 void Curve::addNode(const Vector& newNode, unsigned int insertPosition) 67 72 { … … 253 258 /** 254 259 \brief Calulates the direction of the Curve at time t. 255 \param The time at which to evaluate the curve.256 \returns The v valuated Vector.260 \param t The time at which to evaluate the curve. 261 \returns The valuated Vector. 257 262 */ 258 263 Vector BezierCurve::calcDir (float t) 259 264 { 260 return dirCurve->calcPos(t); 261 } 262 265 return this->dirCurve->calcPos(t); 266 } 267 268 /** 269 \brief Calulates the acceleration (second derivate) of the Curve at time t. 270 \param t The time at which to evaluate the curve. 271 \returns The valuated Vector. 272 */ 263 273 Vector BezierCurve::calcAcc (float t) 264 274 { 265 return dirCurve->dirCurve->calcPos(t);275 return this->dirCurve->getDirCurve()->calcPos(t); 266 276 } 267 277 -
orxonox/trunk/src/lib/math/curve.h
r3836 r4472 20 20 { 21 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 22 //! Handles the curve-points (dynamic List) 28 23 struct PathNode 29 24 { 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.25 int number; //!< The N-th node of this curve. 26 float factor; //!< Curve specific multiplier factor. 27 Vector vFactor; //!< A Vector-factor for multipliing. 28 Vector position; //!< Vector Pointung to this curve-point. 29 PathNode* next; //!< Pointer to the next Node. 35 30 }; 36 31 37 PathNode* firstNode; //!< First node of the curve.38 PathNode* currentNode; //!< The node we are working with (the Last node).39 40 41 private:42 virtual void rebuild(void) = 0;43 32 public: 44 33 Curve(void); 45 34 46 Curve* dirCurve; //!< The derivation-curve of this Curve.47 35 void addNode(const Vector& newNode); 48 36 void addNode(const Vector& newNode, unsigned int insertPosition); 49 37 Vector getNode(unsigned int nodeToFind); 50 inline int getNodeCount(void) { return this->nodeCount;} 38 /** \returns the count of nodes in this curve */ 39 inline int getNodeCount(void) const { return this->nodeCount; }; 40 /** \returns the directional Curve */ 41 Curve* getDirCurve(void) const { return this->dirCurve; }; 51 42 43 /** \param t the value on the curve [0-1] \returns Vector to the position */ 52 44 virtual Vector calcPos(float t) = 0; 45 /** \param t the value on the curve [0-1] \returns the direction */ 53 46 virtual Vector calcDir(float t) = 0; 47 /** \param t the value on the curve [0-1] \returns the acceleration */ 54 48 virtual Vector calcAcc(float t) = 0; 49 /** \param t the value on the curve [0-1] \returns quaternion of the rotation */ 55 50 virtual Quaternion calcQuat(float t) = 0; 56 51 57 52 // DEBUG 58 53 void debug(void); 54 55 private: 56 /** \brief rebuilds the curve */ 57 virtual void rebuild(void) = 0; 58 59 protected: 60 int nodeCount; //!< The count of nodes the Curve has. 61 Vector curvePoint; //!< The point on the Cureve at a local Time. 62 float localTime; //!< If the time of one point is asked more than once the programm will not calculate it again. 63 int derivation; //!< Which derivation of a Curve is this. 64 65 Curve* dirCurve; //!< The derivation-curve of this Curve. 66 67 PathNode* firstNode; //!< First node of the curve. 68 PathNode* currentNode; //!< The node we are working with (the Last node). 69 59 70 }; 60 71 … … 66 77 class BezierCurve : public Curve 67 78 { 68 private:69 void rebuild(void);70 79 public: 71 80 BezierCurve(void); … … 73 82 virtual ~BezierCurve(void); 74 83 75 Vector calcPos(float t);76 Vector calcDir(float t);77 Vector calcAcc(float t);78 Quaternion calcQuat(float t);84 virtual Vector calcPos(float t); 85 virtual Vector calcDir(float t); 86 virtual Vector calcAcc(float t); 87 virtual Quaternion calcQuat(float t); 79 88 80 89 81 90 Vector getPos(void) const; 91 92 private: 93 void rebuild(void); 82 94 }; 83 95
Note: See TracChangeset
for help on using the changeset viewer.