- Timestamp:
- 08/02/12 18:19:59 (12 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/EdgeDetector.cpp
r2613 r2619 12 12 13 13 #include "EdgeDetector.h" 14 #include "MathUtils.h" 14 15 15 16 using namespace std ; … … 28 29 void EdgeDetector::setDirection( const Matrix<Double> &dir ) 29 30 { 30 dir_.reference( dir ) ; 31 //dir_.reference( dir ) ; 32 dir_ = dir.copy() ; 33 Vector<Double> ra( dir_.row(0) ) ; 34 mathutil::rotateRA( ra ) ; 31 35 resizeTempArea( dir.nrow() ) ; 32 36 } -
trunk/src/MathUtils.cpp
r2258 r2619 292 292 } 293 293 294 void 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 335 void mathutil::rotateRA( const Vector<Double> &in, 336 Vector<Double> &out ) 337 { 338 out = in.copy() ; 339 rotateRA( out ) ; 340 } 341 294 342 double mathutil::gettimeofday_sec() 295 343 { -
trunk/src/MathUtils.h
r2258 r2619 110 110 111 111 /** 112 * RA nomalization: n*2pi rotation if necessary 113 **/ 114 void rotateRA( const casa::Vector<casa::Double> &in, 115 casa::Vector<casa::Double> &out ) ; 116 void rotateRA( casa::Vector<casa::Double> &v ) ; 117 118 /** 112 119 * tool to record current time stamp 113 120 **/
Note:
See TracChangeset
for help on using the changeset viewer.