Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

Location:
trunk/src/lib/coord
Files:
2 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/**
  • trunk/src/lib/coord/p_node.h

    r5406 r5414  
    8383  void setAbsDir (const Quaternion& absDir);
    8484  void setAbsDir (float x, float y, float z);
     85  void setAbsDirSoft(const Quaternion& absDirSoft, float bias = 1.0);
     86  void setAbsDirSoft(float x, float y, float z, float bias = 1.0);
    8587  /** @returns the absolute Direction */
    8688  inline const Quaternion& getAbsDir () const { return this->absDirection; };
Note: See TracChangeset for help on using the changeset viewer.