USGS

Isis 3.0 Object Programmers' Reference

Home

LunarLambertMcEwen.cpp
1 #include <cmath>
2 #include "LunarLambertMcEwen.h"
3 #include "IException.h"
4 
5 namespace Isis {
6  LunarLambertMcEwen::LunarLambertMcEwen(Pvl &pvl) : PhotoModel(pvl) {
7  p_photoM1 = -0.019;
8  p_photoM2 = 0.000242;
9  p_photoM3 = -0.00000146;
10 
11  double c30 = cos(30.0 * Isis::PI / 180.0);
12  double xl30 = 1.0 + p_photoM1 * 30.0 + p_photoM2 * pow(30.0, 2.0) +
13  p_photoM3 * pow(30.0, 3);
14  p_photoR30 = 2.0 * xl30 * c30 / (1.0 + c30) + (1.0 - xl30) * c30;
15  }
16 
17  double LunarLambertMcEwen::PhotoModelAlgorithm(double phase, double incidence,
18  double emission) {
19  static double pht_moonpr;
20  double incrad;
21  double emarad;
22  double munot;
23  double mu;
24 
25  static double old_phase = -9999;
26  static double old_incidence = -9999;
27  static double old_emission= -9999;
28 
29  if (old_phase == phase && old_incidence == incidence && old_emission == emission) {
30  return pht_moonpr;
31  }
32 
33  old_phase = phase;
34  old_incidence = incidence;
35  old_emission = emission;
36 
37  incrad = incidence * Isis::PI / 180.0;
38  emarad = emission * Isis::PI / 180.0;
39  munot = cos(incrad);
40  mu = cos(emarad);
41 
42  double xl = 1.0 + p_photoM1 * phase + p_photoM2 * pow(phase, 2) +
43  p_photoM3 * pow(phase, 3);
44  double r = 2.0 * xl * munot / (mu + munot) + (1.0 - xl) * munot;
45 
46  if(r <= 0.0) {
47  pht_moonpr = 0.0;
48  }
49  else {
50  pht_moonpr = p_photoR30 / r;
51  }
52 
53  return pht_moonpr;
54  }
55 }
56 
57 extern "C" Isis::PhotoModel *LunarLambertMcEwenPlugin(Isis::Pvl &pvl) {
58  return new Isis::LunarLambertMcEwen(pvl);
59 }