Isis 3 Programmer Reference
LunarLambert.cpp
1 #include <cmath>
2 #include "LunarLambert.h"
3 
4 namespace Isis {
5  LunarLambert::LunarLambert(Pvl &pvl) : PhotoModel(pvl) {
6  PvlGroup &algo = pvl.findObject("PhotometricModel")
7  .findGroup("Algorithm", Pvl::Traverse);
8  // Set default value
9  SetPhotoL(1.0);
10 
11  // Get value from user
12  if(algo.hasKeyword("L")) SetPhotoL(algo["L"]);
13  }
14 
25  void LunarLambert::SetPhotoL(const double l) {
26  p_photoL = l;
27  }
28 
29  double LunarLambert::PhotoModelAlgorithm(double phase, double incidence,
30  double emission) {
31  static double pht_lunlam;
32  double incrad;
33  double emarad;
34  double munot;
35  double mu;
36 
37  static double old_phase = -9999;
38  static double old_incidence = -9999;
39  static double old_emission= -9999;
40 
41  if (old_phase == phase && old_incidence == incidence && old_emission == emission) {
42  return pht_lunlam;
43  }
44 
45  old_phase = phase;
46  old_incidence = incidence;
47  old_emission = emission;
48 
49  incrad = incidence * Isis::PI / 180.0;
50  emarad = emission * Isis::PI / 180.0;
51  munot = cos(incrad);
52  mu = cos(emarad);
53 
54  if(munot <= 0.0 || mu <= 0.0 || incidence == 90.0 ||
55  emission == 90.0) {
56  pht_lunlam = 0.0;
57  }
58 // else if(PhotoL() == 0.0) {
59  else if(p_photoL == 0.0) {
60  pht_lunlam = munot;
61  }
62 // else if(PhotoL() == 1.0) {
63  else if(p_photoL == 1.0) {
64  pht_lunlam = 2.0 * munot / (munot + mu);
65  }
66  else {
67 // pht_lunlam = munot * ((1.0 - PhotoL()) + 2.0 *
68 // PhotoL() / (munot + mu));
69  pht_lunlam = munot * ((1.0 - p_photoL) + 2.0 *
70  p_photoL / (munot + mu));
71  }
72 
73  return pht_lunlam;
74  }
75 }
76 
77 extern "C" Isis::PhotoModel *LunarLambertPlugin(Isis::Pvl &pvl) {
78  return new Isis::LunarLambert(pvl);
79 }
const double PI
The mathematical constant PI.
Definition: Constants.h:56
Search child objects.
Definition: PvlObject.h:170
void SetPhotoL(const double l)
Set the Lunar-Lambert function weight.
Container for cube-like labels.
Definition: Pvl.h:135
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Lunar (Lommel-Seeliger)-Lambert law photometric model Derive model albedo for Lunar (Lommel-Seeliger)...
Definition: LunarLambert.h:48
virtual double PhotoModelAlgorithm(double phase, double incidence, double emission)
Return photometric L value.