Isis 3 Programmer Reference
Minnaert.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7#include <cmath>
8#include "Minnaert.h"
9#include "IException.h"
10
11namespace Isis {
12 Minnaert::Minnaert(Pvl &pvl) : PhotoModel(pvl) {
13 PvlGroup &algo = pvl.findObject("PhotometricModel")
14 .findGroup("Algorithm", Pvl::Traverse);
15 // Set default value
16 SetPhotoK(1.0);
17 // Get value from user
18 if(algo.hasKeyword("K")) SetPhotoK(algo["K"]);
19 }
20
29 void Minnaert::SetPhotoK(const double k) {
30 p_photoK = k;
31 }
32
33 double Minnaert::PhotoModelAlgorithm(double phase, double incidence,
34 double emission) {
35 static double pht_minnaert;
36 double incrad;
37 double emarad;
38 double munot;
39 double mu;
40
41 static double old_phase = -9999;
42 static double old_incidence = -9999;
43 static double old_emission= -9999;
44
45 if (old_phase == phase && old_incidence == incidence && old_emission == emission) {
46 return pht_minnaert;
47 }
48
49 old_phase = phase;
50 old_incidence = incidence;
51 old_emission = emission;
52
53 incrad = incidence * Isis::PI / 180.0;
54 emarad = emission * Isis::PI / 180.0;
55 munot = cos(incrad);
56 mu = cos(emarad);
57
58 if(munot <= 0.0 || mu <= 0.0 || incidence == 90.0 ||
59 emission == 90.0) {
60 pht_minnaert = 0.0;
61 }
62// else if(PhotoK() == 1.0) {
63 else if(p_photoK == 1.0) {
64 pht_minnaert = munot;
65 }
66 else {
67// pht_minnaert = munot * pow((munot * mu), (PhotoK() - 1.0));
68 pht_minnaert = munot * pow((munot * mu), (p_photoK - 1.0));
69 }
70
71 return pht_minnaert;
72 }
73}
74
75extern "C" Isis::PhotoModel *MinnaertPlugin(Isis::Pvl &pvl) {
76 return new Isis::Minnaert(pvl);
77}
Minnaert photometric model Derive model albedo using Minnaert equation.
Definition Minnaert.h:42
Container for cube-like labels.
Definition Pvl.h:119
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
const double PI
The mathematical constant PI.
Definition Constants.h:40