Ignore:
Timestamp:
08/02/12 18:19:59 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-2825

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: not available

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Take care of 2pi rotation on RA axis.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MathUtils.cpp

    r2258 r2619  
    292292}
    293293
     294void mathutil::rotateRA( Vector<Double> &v )
     295{
     296  uInt len = v.nelements() ; 
     297  Vector<Double> work( len ) ;
     298
     299  for ( uInt i = 0 ; i < len ; i++ ) {
     300    work[i] = fmod( v[i], C::_2pi ) ;
     301    if ( work[i] < 0.0 ) {
     302      work[i] += C::_2pi ;
     303    }
     304  }
     305  //cout << "zero2twopi: out=" << work << endl ;
     306
     307  Vector<uInt> quad( len ) ;
     308  Vector<uInt> nquad( 4, 0 ) ;
     309  for ( uInt i = 0 ; i < len ; i++ ) {
     310    uInt q = uInt( work[i] / C::pi_2 ) ;
     311    nquad[q]++ ;
     312    quad[i] = q ;
     313  }
     314  //cout << "nquad = " << nquad << endl ;
     315
     316  Vector<Bool> rot( 4, False ) ;
     317  if ( nquad[0] > 0 && nquad[3] > 0
     318       && ( nquad[1] == 0 || nquad[2] == 0 ) ) {
     319    //cout << "need rotation" << endl ;
     320    rot[3] = True ;
     321    rot[2] = (nquad[1]==0 && nquad[2]>0) ;
     322  }
     323  //cout << "rot=" << rot << endl ;
     324
     325  for ( uInt i = 0 ; i < len ; i++ ) {
     326    if ( rot[quad[i]] ) {
     327      v[i] = work[i] - C::_2pi ;
     328    }
     329    else {
     330      v[i] = work[i] ;
     331    }
     332  }
     333}
     334
     335void mathutil::rotateRA( const Vector<Double> &in,
     336                         Vector<Double> &out )
     337{
     338  out = in.copy() ;
     339  rotateRA( out ) ;
     340}
     341
    294342double mathutil::gettimeofday_sec()
    295343{
Note: See TracChangeset for help on using the changeset viewer.