Isis 3 Programmer Reference
LunarLambertMcEwen.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include <cmath>
8 #include "LunarLambertMcEwen.h"
9 #include "IException.h"
10 
11 namespace Isis {
12  LunarLambertMcEwen::LunarLambertMcEwen(Pvl &pvl) : PhotoModel(pvl) {
13  p_photoM1 = -0.019;
14  p_photoM2 = 0.000242;
15  p_photoM3 = -0.00000146;
16 
17  double c30 = cos(30.0 * Isis::PI / 180.0);
18  double xl30 = 1.0 + p_photoM1 * 30.0 + p_photoM2 * pow(30.0, 2.0) +
19  p_photoM3 * pow(30.0, 3);
20  p_photoR30 = 2.0 * xl30 * c30 / (1.0 + c30) + (1.0 - xl30) * c30;
21  }
22 
23  double LunarLambertMcEwen::PhotoModelAlgorithm(double phase, double incidence,
24  double emission) {
25  static double pht_moonpr;
26  double incrad;
27  double emarad;
28  double munot;
29  double mu;
30 
31  static double old_phase = -9999;
32  static double old_incidence = -9999;
33  static double old_emission= -9999;
34 
35  if (old_phase == phase && old_incidence == incidence && old_emission == emission) {
36  return pht_moonpr;
37  }
38 
39  old_phase = phase;
40  old_incidence = incidence;
41  old_emission = emission;
42 
43  incrad = incidence * Isis::PI / 180.0;
44  emarad = emission * Isis::PI / 180.0;
45  munot = cos(incrad);
46  mu = cos(emarad);
47 
48  double xl = 1.0 + p_photoM1 * phase + p_photoM2 * pow(phase, 2) +
49  p_photoM3 * pow(phase, 3);
50  double r = 2.0 * xl * munot / (mu + munot) + (1.0 - xl) * munot;
51 
52  if(r <= 0.0) {
53  pht_moonpr = 0.0;
54  }
55  else {
56  pht_moonpr = p_photoR30 / r;
57  }
58 
59  return pht_moonpr;
60  }
61 }
62 
63 extern "C" Isis::PhotoModel *LunarLambertMcEwenPlugin(Isis::Pvl &pvl) {
64  return new Isis::LunarLambertMcEwen(pvl);
65 }
Isis::PhotoModel
Definition: PhotoModel.h:41
Isis::PI
const double PI
The mathematical constant PI.
Definition: Constants.h:40
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::LunarLambertMcEwen
Moonpr photometric model Computes normalized albedo for the Moon, normalized to 0 degrees emission an...
Definition: LunarLambertMcEwen.h:25
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16