Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5419 in orxonox.OLD for trunk/src/lib/coord


Ignore:
Timestamp:
Oct 22, 2005, 10:55:51 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: MUCH better algorithm for the QuaternionSlerp in PNodes rotate-to function
also updated the Quaternion class, to now hold dot-product and distance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/coord/p_node.cc

    r5414 r5419  
    1111   ### File Specific:
    1212   main-programmer: Patrick Boenzli
    13    co-programmer:
     13   co-programmer: Benjamin Grauer
    1414*/
    1515
     
    630630      if (unlikely(this->toDirection != NULL))
    631631      {
    632         Quaternion rotQuat = Quaternion::quatSlerp(Quaternion(), (*this->toDirection / this->relDirection), fabsf(dt)*this->bias);
    633         if (likely(rotQuat.getSpacialAxisAngle() > PNODE_ITERATION_DELTA))
     632        Quaternion rotQuat = Quaternion::quatSlerp(this->relDirection,*this->toDirection, fabsf(dt)*this->bias);
     633        if (this->relDirection.distance(rotQuat) >PNODE_ITERATION_DELTA)
    634634        {
    635           this->shiftDir(rotQuat);
     635          this->relDirection = rotQuat;
     636          this->bRelDirChanged;
    636637        }
    637638        else
Note: See TracChangeset for help on using the changeset viewer.