Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5677 in orxonox.OLD for trunk


Ignore:
Timestamp:
Nov 21, 2005, 10:02:56 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more optimisations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/math/matrix.cc

    r5675 r5677  
    8888  int eigenValuesCount = this->getEigenValues(eigenValues);
    8989
    90   /* eigenvec creation */
    91   eigVc1.x = -1/this->m13*(this->m33 - eigenValues.x) +
    92       (this->m32*(-this->m31*this->m32 + this->m12*this->m33 - this->m12*eigenValues.x)) /
    93       this->m13*(-this->m13*this->m22 - this->m12*this->m23 + this->m13*eigenValues.x);
     90  if (eigenValuesCount == 2 || eigenValuesCount == 3)
     91  {
     92    /* eigenvec creation */
     93    eigVc1.x = -1/this->m13*(this->m33 - eigenValues.x) +
     94        (this->m32*(-this->m31*this->m32 + this->m12*this->m33 - this->m12*eigenValues.x)) /
     95        this->m13*(-this->m13*this->m22 - this->m12*this->m23 + this->m13*eigenValues.x);
    9496
    95   eigVc1.y = -( -this->m13*this->m23 + this->m12*this->m33 - this->m12*eigenValues.x) /
    96       (-this->m31*this->m22 + this->m12*this->m23 + this->m13*eigenValues.x);
     97    eigVc1.y = -( -this->m13*this->m23 + this->m12*this->m33 - this->m12*eigenValues.x) /
     98        (-this->m31*this->m22 + this->m12*this->m23 + this->m13*eigenValues.x);
    9799
    98   eigVc1.z = 1.0f;
     100    eigVc1.z = 1.0f;
    99101
    100   eigVc2.x = -1/this->m13*(this->m33 - eigenValues.y) +
    101       (this->m32*(-this->m31*this->m32 + this->m12*this->m33 - this->m12*eigenValues.y)) /
    102       this->m13*(-this->m13*this->m22 - this->m12*this->m23 + this->m13*eigenValues.y);
     102    eigVc2.x = -1/this->m13*(this->m33 - eigenValues.y) +
     103        (this->m32*(-this->m31*this->m32 + this->m12*this->m33 - this->m12*eigenValues.y)) /
     104        this->m13*(-this->m13*this->m22 - this->m12*this->m23 + this->m13*eigenValues.y);
    103105
    104   eigVc2.y = -( -this->m13*this->m23 + this->m12*this->m33 - this->m12*eigenValues.y) /
    105       (-this->m31*this->m22 + this->m12*this->m23 + this->m13*eigenValues.y);
     106    eigVc2.y = -( -this->m13*this->m23 + this->m12*this->m33 - this->m12*eigenValues.y) /
     107        (-this->m31*this->m22 + this->m12*this->m23 + this->m13*eigenValues.y);
    106108
    107   eigVc2.z = 1.0f;
     109    eigVc2.z = 1.0f;
    108110
    109   eigVc3 = eigVc1.cross(eigVc2);
    110 
     111    eigVc3 = eigVc1.cross(eigVc2);
     112  }
     113  else if (eigenValuesCount == 1)
     114  {
     115    eigVc1 = Vector(1,0,0);
     116    eigVc2 = Vector(0,1,0);
     117    eigVc3 = Vector(0,0,1);
     118  }
    111119  eigVc1.normalize();
    112120  eigVc2.normalize();
Note: See TracChangeset for help on using the changeset viewer.