Changeset 3328 in orxonox.OLD for orxonox/branches/parenting
- Timestamp:
- Jan 3, 2005, 7:09:17 PM (20 years ago)
- Location:
- orxonox/branches/parenting/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/curve.cc
r3327 r3328 215 215 { 216 216 this->derivation = 0; 217 dirCurve = new UPointCurve(1);218 217 this->init(); 219 218 } … … 309 308 tmpNode = tmpNode->next; 310 309 } 311 312 // rebuilding the Derivation curve313 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 }329 310 } 330 311 … … 358 339 Vector UPointCurve::calcDir (float t) 359 340 { 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; 361 356 } 362 357 -
orxonox/branches/parenting/src/world.cc
r3327 r3328 451 451 printf("%f %f %f\n",testCurve->calcPos(i).x,testCurve->calcPos(i).y,testCurve->calcPos(i).z); 452 452 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); 454 454 } 455 455 glEnd();
Note: See TracChangeset
for help on using the changeset viewer.