Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3328 in orxonox.OLD


Ignore:
Timestamp:
Jan 3, 2005, 7:09:17 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/updater: derivation now works too for the UPointCurve

Location:
orxonox/branches/parenting/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/curve.cc

    r3327 r3328  
    215215{
    216216  this->derivation = 0;
    217   dirCurve = new UPointCurve(1);
    218217  this->init();
    219218}
     
    309308      tmpNode = tmpNode->next;
    310309    }
    311 
    312   // rebuilding the Derivation curve
    313   if(this->derivation == 0)
    314     {
    315       tmpNode = firstNode;
    316       delete dirCurve;
    317       dirCurve = new UPointCurve(1);
    318       while(tmpNode->next)
    319         {
    320           Vector tmpVector = (tmpNode->next->position)- (tmpNode->position);
    321           tmpVector.x*=(float)nodeCount;
    322           tmpVector.y*=(float)nodeCount;
    323           tmpVector.z*=(float)nodeCount;
    324           tmpVector.normalize();
    325           this->dirCurve->addNode(tmpVector);
    326           tmpNode = tmpNode->next;
    327         }
    328     }
    329310}
    330311
     
    358339Vector UPointCurve::calcDir (float t)
    359340{
    360   return dirCurve->calcPos(t);
     341  PathNode* tmpNode = firstNode;
     342  Vector ret = Vector(0.0,0.0,0.0);
     343  float factor = 1.0/t;
     344  int k=0;
     345  while(tmpNode)
     346    {
     347      ret.x += tmpNode->vFactor.x * factor *k;
     348      ret.y += tmpNode->vFactor.y * factor *k;
     349      ret.z += tmpNode->vFactor.z * factor *k;
     350      factor *= t;
     351      k++;
     352      tmpNode = tmpNode->next;
     353    }
     354  ret.normalize();
     355  return ret;
    361356}
    362357
  • orxonox/branches/parenting/src/world.cc

    r3327 r3328  
    451451      printf("%f %f %f\n",testCurve->calcPos(i).x,testCurve->calcPos(i).y,testCurve->calcPos(i).z);
    452452      glVertex3f(testCurve->calcPos(i).x, testCurve->calcPos(i).y, testCurve->calcPos(i).z);
    453       //      glVertex3f(testCurve->calcPos(i).x+testCurve->calcDir(i).x, testCurve->calcPos(i).y+testCurve->calcDir(i).y, testCurve->calcPos(i).z+testCurve->calcDir(i).z);
     453      glVertex3f(testCurve->calcPos(i).x+testCurve->calcDir(i).x, testCurve->calcPos(i).y+testCurve->calcDir(i).y, testCurve->calcPos(i).z+testCurve->calcDir(i).z);
    454454    }
    455455  glEnd();
Note: See TracChangeset for help on using the changeset viewer.