public boolean extractEigenvectors(Vec3 result1,Vec3 result2,Vec3 result3){
  if (result1 == null || result2 == null || result3 == null) {
    throw new IllegalArgumentException(Logger.logMessage(Logger.ERROR,"Matrix4","extractEigenvectors","missingResult"));
  }
  if (this.m[1] != this.m[4] || this.m[2] != this.m[8] || this.m[6] != this.m[9]) {
    return false;
  }
  final double EPSILON=1.0e-10;
  final int MAX_SWEEPS=32;
  double m11=this.m[0];
  double m12=this.m[1];
  double m13=this.m[2];
  double m22=this.m[5];
  double m23=this.m[6];
  double m33=this.m[10];
  double[][] r=new double[3][3];
  r[0][0]=r[1][1]=r[2][2]=1d;
  for (int a=0; a < MAX_SWEEPS; a++) {
    if (Math.abs(m12) < EPSILON && Math.abs(m13) < EPSILON && Math.abs(m23) < EPSILON) {
      break;
    }
    if (m12 != 0) {
      double u=(m22 - m11) * 0.5 / m12;
      double u2=u * u;
      double u2p1=u2 + 1;
      double t=(u2p1 != u2) ? ((u < 0) ? -1 : 1) * (Math.sqrt(u2p1) - Math.abs(u)) : 0.5 / u;
      double c=1 / Math.sqrt(t * t + 1);
      double s=c * t;
      m11-=t * m12;
      m22+=t * m12;
      m12=0;
      double temp=c * m13 - s * m23;
      m23=s * m13 + c * m23;
      m13=temp;
      for (int i=0; i < 3; i++) {
        temp=c * r[i][0] - s * r[i][1];
        r[i][1]=s * r[i][0] + c * r[i][1];
        r[i][0]=temp;
      }
    }
    if (m13 != 0) {
      double u=(m33 - m11) * 0.5 / m13;
      double u2=u * u;
      double u2p1=u2 + 1;
      double t=(u2p1 != u2) ? ((u < 0) ? -1 : 1) * (Math.sqrt(u2p1) - Math.abs(u)) : 0.5 / u;
      double c=1 / Math.sqrt(t * t + 1);
      double s=c * t;
      m11-=t * m13;
      m33+=t * m13;
      m13=0;
      double temp=c * m12 - s * m23;
      m23=s * m12 + c * m23;
      m12=temp;
      for (int i=0; i < 3; i++) {
        temp=c * r[i][0] - s * r[i][2];
        r[i][2]=s * r[i][0] + c * r[i][2];
        r[i][0]=temp;
      }
    }
    if (m23 != 0) {
      double u=(m33 - m22) * 0.5 / m23;
      double u2=u * u;
      double u2p1=u2 + 1;
      double t=(u2p1 != u2) ? ((u < 0) ? -1 : 1) * (Math.sqrt(u2p1) - Math.abs(u)) : 0.5 / u;
      double c=1 / Math.sqrt(t * t + 1);
      double s=c * t;
      m22-=t * m23;
      m33+=t * m23;
      m23=0;
      double temp=c * m12 - s * m13;
      m13=s * m12 + c * m13;
      m12=temp;
      for (int i=0; i < 3; i++) {
        temp=c * r[i][1] - s * r[i][2];
        r[i][2]=s * r[i][1] + c * r[i][2];
        r[i][1]=temp;
      }
    }
  }
  int i1=0;
  int i2=1;
  int i3=2;
  int itemp;
  double temp;
  if (m11 < m22) {
    temp=m11;
    m11=m22;
    m22=temp;
    itemp=i1;
    i1=i2;
    i2=itemp;
  }
  if (m22 < m33) {
    temp=m22;
    m22=m33;
    m33=temp;
    itemp=i2;
    i2=i3;
    i3=itemp;
  }
  if (m11 < m22) {
    temp=m11;
    m11=m22;
    m22=temp;
    itemp=i1;
    i1=i2;
    i2=itemp;
  }
  result1.set(r[0][i1],r[1][i1],r[2][i1]);
  result2.set(r[0][i2],r[1][i2],r[2][i2]);
  result3.set(r[0][i3],r[1][i3],r[2][i3]);
  result1.normalize();
  result2.normalize();
  result3.normalize();
  result1.multiply(m11);
  result2.multiply(m22);
  result3.multiply(m33);
  return true;
}

public boolean extractEigenvectors ( Vec3 result1 , Vec3 result2 , Vec3 result3 ) { if ( result1 == null || result2 == null || result3 == null ) { throw new IllegalArgumentException ( Logger . logMessage ( Logger . ERROR , "Matrix4" , "extractEigenvectors" , "missingResult" ) ) ; } if ( this . m [ 1 ] != this . m [ 4 ] || this . m [ 2 ] != this . m [ 8 ] || this . m [ 6 ] != this . m [ 9 ] ) { return false ; } final double EPSILON = 1.0e-10 ; final int MAX_SWEEPS = 32 ; double m11 = this . m [ 0 ] ; double m12 = this . m [ 1 ] ; double m13 = this . m [ 2 ] ; double m22 = this . m [ 5 ] ; double m23 = this . m [ 6 ] ; double m33 = this . m [ 10 ] ; double [ ] [ ] r = new double [ 3 ] [ 3 ] ; r [ 0 ] [ 0 ] = r [ 1 ] [ 1 ] = r [ 2 ] [ 2 ] = 1d ; for ( int a = 0 ; a < MAX_SWEEPS ; a ++ ) { if ( Math . abs ( m12 ) < EPSILON && Math . abs ( m13 ) < EPSILON && Math . abs ( m23 ) < EPSILON ) { break ; } if ( m12 != 0 ) { double u = ( m22 - m11 ) * 0.5 / m12 ; double u2 = u * u ; double u2p1 = u2 + 1 ; double t = ( u2p1 != u2 ) ? ( ( u < 0 ) ? - 1 : 1 ) * ( Math . sqrt ( u2p1 ) - Math . abs ( u ) ) : 0.5 / u ; double c = 1 / Math . sqrt ( t * t + 1 ) ; double s = c * t ; m11 -= t * m12 ; m22 += t * m12 ; m12 = 0 ; double temp = c * m13 - s * m23 ; m23 = s * m13 + c * m23 ; m13 = temp ; for ( int i = 0 ; i < 3 ; i ++ ) { temp = c * r [ i ] [ 0 ] - s * r [ i ] [ 1 ] ; r [ i ] [ 1 ] = s * r [ i ] [ 0 ] + c * r [ i ] [ 1 ] ; r [ i ] [ 0 ] = temp ; } } if ( m13 != 0 ) { double u = ( m33 - m11 ) * 0.5 / m13 ; double u2 = u * u ; double u2p1 = u2 + 1 ; double t = ( u2p1 != u2 ) ? ( ( u < 0 ) ? - 1 : 1 ) * ( Math . sqrt ( u2p1 ) - Math . abs ( u ) ) : 0.5 / u ; double c = 1 / Math . sqrt ( t * t + 1 ) ; double s = c * t ; m11 -= t * m13 ; m33 += t * m13 ; m13 = 0 ; double temp = c * m12 - s * m23 ; m23 = s * m12 + c * m23 ; m12 = temp ; for ( int i = 0 ; i < 3 ; i ++ ) { temp = c * r [ i ] [ 0 ] - s * r [ i ] [ 2 ] ; r [ i ] [ 2 ] = s * r [ i ] [ 0 ] + c * r [ i ] [ 2 ] ; r [ i ] [ 0 ] = temp ; } } if ( m23 != 0 ) { double u = ( m33 - m22 ) * 0.5 / m23 ; double u2 = u * u ; double u2p1 = u2 + 1 ; double t = ( u2p1 != u2 ) ? ( ( u < 0 ) ? - 1 : 1 ) * ( Math . sqrt ( u2p1 ) - Math . abs ( u ) ) : 0.5 / u ; double c = 1 / Math . sqrt ( t * t + 1 ) ; double s = c * t ; m22 -= t * m23 ; m33 += t * m23 ; m23 = 0 ; double temp = c * m12 - s * m13 ; m13 = s * m12 + c * m13 ; m12 = temp ; for ( int i = 0 ; i < 3 ; i ++ ) { temp = c * r [ i ] [ 1 ] - s * r [ i ] [ 2 ] ; r [ i ] [ 2 ] = s * r [ i ] [ 1 ] + c * r [ i ] [ 2 ] ; r [ i ] [ 1 ] = temp ; } } } int i1 = 0 ; int i2 = 1 ; int i3 = 2 ; int itemp ; double temp ; if ( m11 < m22 ) { temp = m11 ; m11 = m22 ; m22 = temp ; itemp = i1 ; i1 = i2 ; i2 = itemp ; } if ( m22 < m33 ) { temp = m22 ; m22 = m33 ; m33 = temp ; itemp = i2 ; i2 = i3 ; i3 = itemp ; } if ( m11 < m22 ) { temp = m11 ; m11 = m22 ; m22 = temp ; itemp = i1 ; i1 = i2 ; i2 = itemp ; } result1 . set ( r [ 0 ] [ i1 ] , r [ 1 ] [ i1 ] , r [ 2 ] [ i1 ] ) ; result2 . set ( r [ 0 ] [ i2 ] , r [ 1 ] [ i2 ] , r [ 2 ] [ i2 ] ) ; result3 . set ( r [ 0 ] [ i3 ] , r [ 1 ] [ i3 ] , r [ 2 ] [ i3 ] ) ; result1 . normalize ( ) ; result2 . normalize ( ) ; result3 . normalize ( ) ; result1 . multiply ( m11 ) ; result2 . multiply ( m22 ) ; result3 . multiply ( m33 ) ; return true ; }
returns this symmetric matrix ' s eigenvectors . the eigenvectors are returned in the specified result arguments in order of descending magnitude ( most prominent to least prominent ) . each eigenvector has length equal to its corresponding eigenvalue . < p / > this method returns false if this matrix is not a symmetric matrix .
