Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4472 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Jun 2, 2005, 2:12:23 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: curve doxygen, and redesign

Location:
orxonox/trunk/src/lib/math
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/math/curve.cc

    r3595 r4472  
    6464}
    6565
     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*/
    6671void Curve::addNode(const Vector& newNode, unsigned int insertPosition)
    6772{
     
    253258/**
    254259   \brief Calulates the direction of the Curve at time t.
    255    \param The time at which to evaluate the curve.
    256    \returns The vvaluated Vector.
     260   \param t The time at which to evaluate the curve.
     261   \returns The valuated Vector.
    257262*/
    258263Vector BezierCurve::calcDir (float t)
    259264{
    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*/
    263273Vector BezierCurve::calcAcc (float t)
    264274{
    265   return dirCurve->dirCurve->calcPos(t);
     275  return this->dirCurve->getDirCurve()->calcPos(t);
    266276}
    267277
  • orxonox/trunk/src/lib/math/curve.h

    r3836 r4472  
    2020{
    2121 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 
    2722  //! Handles the curve-points (dynamic List)
    2823  struct PathNode
    2924  {
    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.
    3530  };
    3631
    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;
    4332 public:
    4433  Curve(void);
    4534
    46   Curve* dirCurve;       //!< The derivation-curve of this Curve.
    4735  void addNode(const Vector& newNode);
    4836  void addNode(const Vector& newNode, unsigned int insertPosition);
    4937  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; };
    5142
     43  /** \param t the value on the curve [0-1] \returns Vector to the position */
    5244  virtual Vector calcPos(float t) = 0;
     45  /** \param t the value on the curve [0-1] \returns the direction */
    5346  virtual Vector calcDir(float t) = 0;
     47  /** \param t the value on the curve [0-1] \returns the acceleration */
    5448  virtual Vector calcAcc(float t) = 0;
     49  /** \param t the value on the curve [0-1] \returns quaternion of the rotation */
    5550  virtual Quaternion calcQuat(float t) = 0;
    5651 
    5752  // DEBUG
    5853  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
    5970};
    6071
     
    6677class BezierCurve : public Curve
    6778{
    68  private:
    69   void rebuild(void);
    7079 public:
    7180  BezierCurve(void);
     
    7382  virtual ~BezierCurve(void);
    7483
    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);
    7988 
    8089 
    8190  Vector getPos(void) const;
     91
     92 private:
     93  void rebuild(void);
    8294};
    8395
Note: See TracChangeset for help on using the changeset viewer.