Isis 3 Programmer Reference
LunarLambert.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include <cmath>
8 #include "LunarLambert.h"
9 
10 namespace Isis {
11  LunarLambert::LunarLambert(Pvl &pvl) : PhotoModel(pvl) {
12  PvlGroup &algo = pvl.findObject("PhotometricModel")
13  .findGroup("Algorithm", Pvl::Traverse);
14  // Set default value
15  SetPhotoL(1.0);
16 
17  // Get value from user
18  if(algo.hasKeyword("L")) SetPhotoL(algo["L"]);
19  }
20 
31  void LunarLambert::SetPhotoL(const double l) {
32  p_photoL = l;
33  }
34 
35  double LunarLambert::PhotoModelAlgorithm(double phase, double incidence,
36  double emission) {
37  static double pht_lunlam;
38  double incrad;
39  double emarad;
40  double munot;
41  double mu;
42 
43  static double old_phase = -9999;
44  static double old_incidence = -9999;
45  static double old_emission= -9999;
46 
47  if (old_phase == phase && old_incidence == incidence && old_emission == emission) {
48  return pht_lunlam;
49  }
50 
51  old_phase = phase;
52  old_incidence = incidence;
53  old_emission = emission;
54 
55  incrad = incidence * Isis::PI / 180.0;
56  emarad = emission * Isis::PI / 180.0;
57  munot = cos(incrad);
58  mu = cos(emarad);
59 
60  if(munot <= 0.0 || mu <= 0.0 || incidence == 90.0 ||
61  emission == 90.0) {
62  pht_lunlam = 0.0;
63  }
64 // else if(PhotoL() == 0.0) {
65  else if(p_photoL == 0.0) {
66  pht_lunlam = munot;
67  }
68 // else if(PhotoL() == 1.0) {
69  else if(p_photoL == 1.0) {
70  pht_lunlam = 2.0 * munot / (munot + mu);
71  }
72  else {
73 // pht_lunlam = munot * ((1.0 - PhotoL()) + 2.0 *
74 // PhotoL() / (munot + mu));
75  pht_lunlam = munot * ((1.0 - p_photoL) + 2.0 *
76  p_photoL / (munot + mu));
77  }
78 
79  return pht_lunlam;
80  }
81 }
82 
83 extern "C" Isis::PhotoModel *LunarLambertPlugin(Isis::Pvl &pvl) {
84  return new Isis::LunarLambert(pvl);
85 }
Isis::PhotoModel
Definition: PhotoModel.h:41
Isis::PI
const double PI
The mathematical constant PI.
Definition: Constants.h:40
Isis::LunarLambert
Lunar (Lommel-Seeliger)-Lambert law photometric model Derive model albedo for Lunar (Lommel-Seeliger)...
Definition: LunarLambert.h:32
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::LunarLambert::SetPhotoL
void SetPhotoL(const double l)
Set the Lunar-Lambert function weight.
Definition: LunarLambert.cpp:31
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::LunarLambert::PhotoModelAlgorithm
virtual double PhotoModelAlgorithm(double phase, double incidence, double emission)
Return photometric L value.
Definition: LunarLambert.cpp:35
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16