Changeset 7183 in ntrip for trunk/BNC/src/bncutils.cpp
- Timestamp:
- Aug 14, 2015, 4:56:19 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncutils.cpp
r7053 r7183 415 415 } 416 416 417 // 417 // 418 418 //////////////////////////////////////////////////////////////////////////// 419 419 double Modulo (double x, double y) { … … 426 426 return ((val < 0.0) ? -floor(fabs(val)+0.5) : floor(val+0.5)); 427 427 } 428 429 // 430 //////////////////////////////////////////////////////////////////////////// 431 int factorial(int n) { 432 if (n == 0) { 433 return 1; 434 } 435 else { 436 return (n * factorial(n - 1)); 437 } 438 } 439 440 // 441 //////////////////////////////////////////////////////////////////////////// 442 double associatedLegendreFunction(int n, int m, double t) { 443 double sum = 0.0; 444 int r = (int) floor((n - m) / 2); 445 for (int k = 0; k <= r; k++) { 446 sum += (pow(-1.0, (double)k) * factorial(2*n - 2*k) 447 / (factorial(k) * factorial(n-k) * factorial(n-m-2*k)) 448 * pow(t, (double)n-m-2*k)); 449 } 450 double fac = pow(2.0,(double) -n) * pow((1 - t*t), (double)m/2); 451 return sum *= fac; 452 } 453 428 454 429 455 // Jacobian XYZ --> NEU
Note:
See TracChangeset
for help on using the changeset viewer.