Changeset 3261

Show
Ignore:
Timestamp:
01/26/12 21:06:45 (4 months ago)
Author:
erkn
Message:

allow 0-length half axis

elliosoids may now be prolonged inifientely in 1 direction.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/mcxtrace-1.0/xlib/share/mcxtrace-r.c

    r3164 r3261  
    314314  double u,v,w; 
    315315 
    316   Gamma[0][0]=1/(a*a);Gamma[0][1]=Gamma[0][2]=0; 
    317   Gamma[1][1]=1/(b*b);Gamma[1][0]=Gamma[1][2]=0; 
    318   Gamma[2][2]=1/(c*c);Gamma[2][0]=Gamma[2][1]=0; 
    319  
    320   rot_transpose(Q,Q_t); 
    321   rot_mul(Gamma,Q_t,Tmp); 
    322   rot_mul(Q,Tmp,A); 
     316  Gamma[0][0]=Gamma[0][1]=Gamma[0][2]=0; 
     317  Gamma[1][1]=Gamma[1][0]=Gamma[1][2]=0; 
     318  Gamma[2][2]=Gamma[2][0]=Gamma[2][1]=0; 
     319  /*now set diagonal to ellipsoid half axis if non-zero. 
     320   * This way a zero value mean the sllipsoid extends infinitely along that axis, 
     321   * which is useful for objects only curved in one direction*/  
     322  if (a!=0){ 
     323    Gamma[0][0]=1/(a*a); 
     324  } 
     325  if (b!=0){ 
     326    Gamma[1][1]=1/(b*b); 
     327  } 
     328  if (c!=0){ 
     329    Gamma[2][2]=1/(c*c); 
     330  } 
     331 
     332  if (Q!=NULL){ 
     333    rot_transpose(Q,Q_t); 
     334    rot_mul(Gamma,Q_t,Tmp); 
     335    rot_mul(Q,Tmp,A); 
     336  }else{ 
     337    rot_copy(A,Gamma); 
     338  } 
    323339 
    324340  /*to get the solutions as lengths in m use unit vector along k*/