Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5414 in orxonox.OLD for trunk/src/lib/coord/p_node.cc


Ignore:
Timestamp:
Oct 21, 2005, 9:45:54 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: new functionality in PNode and Element2D
they now support setAbsCoordSofy*
and setAbsDirSoft*

these functions are used in the new Turret, for smooth iteration, so it does not just snap to place

File:
1 edited

Legend:

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

    r5406 r5414  
    415415  this->setAbsDir(Quaternion(Vector(x,y,z), Vector(0,1,0)));
    416416}
     417
     418/**
     419 *  sets the absolute direction
     420 * @param absDir absolute coordinates
     421 */
     422void PNode::setAbsDirSoft (const Quaternion& absDirSoft, float bias)
     423{
     424  if (this->toDirection == NULL)
     425    this->toDirection = new Quaternion();
     426
     427  if (likely(this->parent != NULL))
     428    *this->toDirection = absDirSoft / this->parent->getAbsDir();
     429  else
     430   *this->toDirection = absDirSoft;
     431
     432  this->bias = bias;
     433}
     434
     435/**
     436 * @see void PNode::setAbsDir (const Quaternion& relDir)
     437 * @param x the x direction
     438 * @param y the y direction
     439 * @param z the z direction
     440 *
     441 * main difference is, that here you give a directional vector, that will be translated into a Quaternion
     442 */
     443void PNode::setAbsDirSoft (float x, float y, float z, float bias)
     444{
     445  this->setAbsDirSoft(Quaternion(Vector(x,y,z), Vector(0,1,0)), bias);
     446}
     447
    417448
    418449/**
Note: See TracChangeset for help on using the changeset viewer.