Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3237 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Dec 20, 2004, 1:53:52 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: working again.

Location:
orxonox/trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.in

    r3236 r3237  
    117117DEFS = @DEFS@
    118118DEPDIR = @DEPDIR@
     119DOXYGEN = @DOXYGEN@
     120DOXYGEN_FALSE = @DOXYGEN_FALSE@
     121DOXYGEN_TRUE = @DOXYGEN_TRUE@
    119122ECHO_C = @ECHO_C@
    120123ECHO_N = @ECHO_N@
  • orxonox/trunk/src/collision.cc

    r3231 r3237  
    104104        if( (t = a->root) == NULL) return false;
    105105       
    106   return cctreeTrace( pa, t, ahitflags, trace, impactpoint);
     106  return ccTreeTrace( pa, t, ahitflags, trace, impactpoint);
    107107}
    108108
     
    124124  if( (tb = b->root) == NULL) return false;
    125125 
    126   return cctreeIterate(pa, ta, ahitflags, pb, tb, bhitflags);
     126  return ccTreeIterate(pa, ta, ahitflags, pb, tb, bhitflags);
    127127}
    128128
     
    176176}
    177177
    178 bool cctreeIterate(const Placement* pa, CCTree* ta, unsigned long* ahitflags, const Placement* pb, CCTree* tb, unsigned long* bhitflags)
     178bool ccTreeIterate(const Placement* pa, CCTree* ta, unsigned long* ahitflags, const Placement* pb, CCTree* tb, unsigned long* bhitflags)
    179179{
    180180  bool r = false;
     
    203203        else useB = ta->data.b[ib];
    204204       
    205         r = r || cctreeIterate( pa, useA, ahitflags, pb, useB, bhitflags);
     205        r = r || ccTreeIterate( pa, useA, ahitflags, pb, useB, bhitflags);
    206206       
    207207        if( tb->n == 0) break;
     
    329329}
    330330
    331 bool cctreetrace( const Placement* p, CCTree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint)
     331bool ccTreeTrace( const Placement* p, CCTree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint)
    332332{
    333333  bool r = false;
     
    352352                for (i = 0; i < t->n; i++)
    353353                {
    354                         r = r || cctreeTrace (p, t->data.b[i], &(hfs[i]), trace, &(ips[i]));
     354                        r = r || ccTreeTrace (p, t->data.b[i], &(hfs[i]), trace, &(ips[i]));
    355355                }
    356356                if( r)
  • orxonox/trunk/src/collision.h

    r3231 r3237  
    5252  int store (char* filename);
    5353 
    54   friend bool cctreeTrace( const Placement* p, CCTree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint);
    55   friend bool cctreeIterate(const Placement* pa, CCTree* ta, unsigned long* ahitflags, const Placement* pb, CCTree* tb, unsigned long* bhitflags);
     54  friend bool ccTreeTrace( const Placement* p, CCTree* t, unsigned long* hitflags, const Line* trace, Vector* impactpoint);
     55  friend bool ccTreeIterate(const Placement* pa, CCTree* ta, unsigned long* ahitflags, const Placement* pb, CCTree* tb, unsigned long* bhitflags);
    5656  friend bool checkTrace (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Line* trace, Vector* impactpoint);
    5757  friend bool checkCollision (const Placement* pa, const CollisionCluster* a, unsigned long* ahitflags, const Placement* pb, const CollisionCluster* b, unsigned long* bhitflags);
  • orxonox/trunk/src/importer/framework.cc

    r3211 r3237  
    149149                //              PRINTF(0)("rotAxis: %f, %f, %f\n", rotAxis.x, rotAxis.y, rotAxis.z, rotAngle);
    150150                               
    151                 rotAngle = angle_rad (p1, p2);
     151                rotAngle = angleRad (p1, p2);
    152152                rotQ = Quaternion (rotAngle, rotAxis);
    153153                rotQ = rotQ * rotQlast;
  • orxonox/trunk/src/importer/vector.cc

    r2932 r3237  
    203203   \return the angle between the vectors in radians
    204204*/
    205 float angle_rad (const Vector& v1, const Vector& v2)
     205float angleRad (const Vector& v1, const Vector& v2)
    206206{
    207207  return acos( v1 * v2 / (v1.len() * v2.len()));
     
    215215   \return the angle between the vectors in degrees
    216216*/
    217 float angle_deg (const Vector& v1, const Vector& v2)
     217float angleDeg (const Vector& v1, const Vector& v2)
    218218{
    219219  float f;
     
    243243
    244244/**
    245    \brief calculates a look_at rotation
     245   \brief calculates a lookAt rotation
    246246   \param dir: the direction you want to look
    247247   \param up: specify what direction up should be
     
    578578  Vector axis = x.cross( v);
    579579  axis.normalize();
    580   float angle = angle_rad( x, v);
     580  float angle = angleRad( x, v);
    581581  float ca = cos(angle);
    582582  float sa = sin(angle);
     
    714714   \return the rotated vector
    715715*/
    716 Vector rotate_vector( const Vector& v, const Rotation& r)
     716Vector rotateVector( const Vector& v, const Rotation& r)
    717717{
    718718  Vector t;
     
    745745   \return the distance between the Line and the point
    746746*/
    747 float Line::distance_point (const Vector& v) const
     747float Line::distancePoint (const Vector& v) const
    748748{
    749749  Vector d = v-r;
     
    761761  Vector* fp = new Vector[2];
    762762  Plane p = Plane (r + a.cross(l.a), r, r + a);
    763   fp[1] = p.intersect_line (l);
     763  fp[1] = p.intersectLine (l);
    764764  p = Plane (fp[1], l.a);
    765   fp[0] = p.intersect_line (*this);
     765  fp[0] = p.intersectLine (*this);
    766766  return fp;
    767767}
     
    783783{
    784784  Vector t = a + r;
    785   t = rotate_vector( t, rot);
    786   r = rotate_vector( r, rot),
     785  t = rotateVector( t, rot);
     786  r = rotateVector( r, rot),
    787787  a = t - r;
    788788}
     
    815815   \param l: a line
    816816*/
    817 Vector Plane::intersect_line (const Line& l) const
     817Vector Plane::intersectLine (const Line& l) const
    818818{
    819819  if (n.x*l.a.x+n.y*l.a.y+n.z*l.a.z == 0.0) return Vector(0,0,0);
     
    827827   \return the distance between the plane and the point (can be negative)
    828828*/
    829 float Plane::distance_point (const Vector& p) const
     829float Plane::distancePoint (const Vector& p) const
    830830{
    831831  float l = n.len();
     
    839839   \return 0 if the point is contained within the Plane, positive(negative) if the point is in the positive(negative) semi-space of the Plane
    840840*/
    841 float Plane::locate_point (const Vector& p) const
     841float Plane::locatePoint (const Vector& p) const
    842842{
    843843  return (n.dot(p) + k);
    844844}
     845
     846
     847/**
     848   \brief Creates a new BezierCurve
     849*/
     850BezierCurve::BezierCurve (void)
     851{
     852  nodeCount = 0;
     853  firstNode = new PathNode;
     854  currentNode = firstNode;
     855
     856  firstNode->position = Vector (.0, .0, .0);
     857  firstNode->number = 0;
     858  firstNode->next = 0; // not sure if this really points to NULL!!
     859
     860  return;
     861}
     862
     863/**
     864   \brief Deletes a BezierCurve.
     865   It does this by freeing all the space taken over from the nodes
     866*/
     867BezierCurve::~BezierCurve (void)
     868{
     869  PathNode* tmpNode;
     870  currentNode = firstNode;
     871  while (tmpNode != 0)
     872    {
     873      tmpNode = currentNode;
     874      currentNode = currentNode->next;
     875      delete tmpNode;
     876    }
     877}
     878
     879/**
     880   \brief adds a new Node to the bezier Curve
     881   \param newNode a Vector to the position of the new node
     882*/
     883void BezierCurve::addNode(const Vector& newNode)
     884{
     885  PathNode* tmpNode;
     886  if (nodeCount == 0 )
     887    tmpNode = firstNode;
     888  else
     889    {
     890      tmpNode = new PathNode;
     891      currentNode = currentNode->next = tmpNode;
     892    }
     893  tmpNode->position = newNode;
     894  tmpNode->next = 0; // not sure if this really points to NULL!!
     895  tmpNode->number = (++nodeCount);
     896  return;
     897}
     898
     899/**
     900   \brief calculates the Position on the curve
     901   \param t The position on the Curve (0<=t<=1)
     902   \return the Position on the Path
     903*/
     904Vector BezierCurve::calcPos(float t)
     905{
     906  if (nodeCount <=4)
     907    {
     908      //      if (verbose >= 1)
     909      //      printf ("Please define at least 4 nodes, until now you have only defined %i.\n", nodeCount);
     910      curvePoint = Vector(0,0,0);
     911    }
     912  PathNode* tmpNode = firstNode;
     913   
     914  int k,kn,nn,nkn;
     915  double blend,muk,munk;
     916  Vector b = Vector(0.0,0.0,0.0);
     917 
     918  muk = 1;
     919  munk = pow(1-t,(double)nodeCount);
     920 
     921  for (k=0; k<=nodeCount; k++) {
     922    nn = nodeCount;
     923    kn = k;
     924    nkn = nodeCount - k;
     925    blend = muk * munk;
     926    muk *= t;
     927    munk /= (1-t);
     928    while (nn >= 1) {
     929      blend *= nn;
     930      nn--;
     931      if (kn > 1) {
     932        blend /= (double)kn;
     933        kn--;
     934      }
     935      if (nkn > 1) {
     936        blend /= (double)nkn;
     937        nkn--;
     938      }
     939    }
     940    b.x += tmpNode->position.x * blend;
     941    b.y += tmpNode->position.y * blend;
     942    b.z += tmpNode->position.z * blend;
     943
     944    tmpNode = tmpNode->next;
     945  }
     946  return b;
     947}
     948
     949Vector BezierCurve::calcDirection (float t)
     950{
     951  double diff = .00000000001;
     952 
     953  Vector diffV = ((calcPos(t+diff) - calcPos(t))/diff);
     954  diffV.normalize();
     955  return diffV;
     956}
     957
     958/**
     959  \brief returns the Position of the point calculated on the Curve
     960  \return a Vector to the calculated position
     961*/
     962Vector BezierCurve::getPos() const
     963{
     964  return curvePoint;
     965}
  • orxonox/trunk/src/importer/vector.h

    r3224 r3237  
    4040};
    4141
    42 float angle_deg (const Vector& v1, const Vector& v2);
    43 float angle_rad (const Vector& v1, const Vector& v2);
     42float angleDeg (const Vector& v1, const Vector& v2);
     43float angleRad (const Vector& v1, const Vector& v2);
    4444
    4545//! Quaternion
     
    9898
    9999//!< Apply a rotation to a vector
    100 Vector rotate_vector( const Vector& v, const Rotation& r);
     100Vector rotateVector( const Vector& v, const Rotation& r);
    101101
    102102//! 3D line
     
    118118 
    119119  float distance (const Line& l) const;
    120   float distance_point (const Vector& v) const;
     120  float distancePoint (const Vector& v) const;
    121121  Vector* footpoints (const Line& l) const;
    122122  float len () const;
     
    144144  ~Plane () {}
    145145 
    146   Vector intersect_line (const Line& l) const;
    147   float distance_point (const Vector& p) const;
    148   float locate_point (const Vector& p) const;
     146  Vector intersectLine (const Line& l) const;
     147  float distancePoint (const Vector& p) const;
     148  float locatePoint (const Vector& p) const;
    149149};
    150150
     151
     152
     153//! Bezier Curve
     154/**
     155   Class to handle bezier curves in 3-dimesnsional space
     156   
     157   needed for  the Tracking system in OrxOnoX.
     158*/
     159class BezierCurve
     160{
     161 private:
     162  int nodeCount;
     163  Vector curvePoint;
     164 
     165  struct PathNode
     166  {
     167    int number;
     168    Vector position;
     169    PathNode* next;
     170  };
     171
     172  PathNode* firstNode;
     173  PathNode* currentNode;
     174
     175 public:
     176  BezierCurve (void);
     177  ~BezierCurve (void);
     178  void addNode (const Vector& newNode);
     179  Vector calcPos (float t);
     180  Vector calcDirection (float t);
     181 
     182  Vector getPos () const;
     183};
     184
     185
     186
    151187#endif /* _VECTOR_H */
Note: See TracChangeset for help on using the changeset viewer.