forked from ngageoint/csm
-
Notifications
You must be signed in to change notification settings - Fork 13
/
PointCloudGM.cpp
134 lines (126 loc) · 5.02 KB
/
PointCloudGM.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//#############################################################################
//
// FILENAME: PointCloudGM.cpp
//
// CLASSIFICATION: Unclassified
//
// DESCRIPTION:
//
// Header for abstract class that is to provide a common interface from
// which CSM point cloud geometric models will inherit. It is derived from
// the GeometricModel class.
//
// This sensor model represents a transformation between ECEF space and a
// three-dimensional "model" space that is defined by the model. Even
// though model coordinates are defined by the model
//
// LIMITATIONS: None
//
//
// SOFTWARE HISTORY:
// Date Author Comment
// ----------- ------ -------
// 18-Feb-2013 DME Initial version.
// 27-May-2015 DME Replaced getValidModelRange function with
// getValidModelBounds function.
// 22-Feb-2018 JPK Replaced macros for inclusion in a single
// library. Reformatted for readability
// 26-Sep-2018 SCM Added define of CSM_LIBRARY for Windows.
//
// NOTES:
//
//#############################################################################
#define CSM_LIBRARY
#include <algorithm>
#include "PointCloudGM.h"
namespace csm
{
//*****************************************************************************
// PointCloudGM::getFamily
//*****************************************************************************
std::string PointCloudGM::getFamily() const
{
return GeometricModel::getFamily() + std::string(CSM_POINTCLOUD_FAMILY);
}
//*****************************************************************************
// PointCloudGM::computeAllSensorPartials
//*****************************************************************************
std::vector<PointCloudGM::SensorPartials>
PointCloudGM::computeAllSensorPartials(const EcefCoord& groundPt,
param::Set pSet,
double desiredPrecision,
double* achievedPrecision,
WarningList* warnings) const
{
std::vector<int> paramIndices = this->getParameterSetIndices(pSet);
std::vector<PointCloudGM::SensorPartials> partials(paramIndices.size());
if (achievedPrecision == NULL)
{
for (std::size_t i = 0; i < paramIndices.size(); ++i)
{
partials[i] = computeSensorPartials(paramIndices[i],
groundPt,
desiredPrecision,
achievedPrecision,
warnings);
}
}
else
{
*achievedPrecision = 0.0;
for (std::size_t i = 0; i < paramIndices.size(); ++i)
{
double tmp;
partials[i] = computeSensorPartials(paramIndices[i],
groundPt,
desiredPrecision,
&tmp,
warnings);
*achievedPrecision = std::max(*achievedPrecision, tmp);
}
}
return partials;
}
//*****************************************************************************
// PointCloudGM::computeAllSensorPartials
//*****************************************************************************
std::vector<PointCloudGM::SensorPartials>
PointCloudGM::computeAllSensorPartials(const ModelCoord& modelPt,
const EcefCoord& groundPt,
param::Set pSet,
double desiredPrecision,
double* achievedPrecision,
WarningList* warnings) const
{
std::vector<int> paramIndices = this->getParameterSetIndices(pSet);
std::vector<PointCloudGM::SensorPartials> partials(paramIndices.size());
if (achievedPrecision == NULL)
{
for (std::size_t i = 0; i < paramIndices.size(); ++i)
{
partials[i] = computeSensorPartials(paramIndices[i],
modelPt,
groundPt,
desiredPrecision,
achievedPrecision,
warnings);
}
}
else
{
*achievedPrecision = 0.0;
for (std::size_t i = 0; i < paramIndices.size(); ++i)
{
double tmp;
partials[i] = computeSensorPartials(paramIndices[i],
modelPt,
groundPt,
desiredPrecision,
&tmp,
warnings);
*achievedPrecision = std::max(*achievedPrecision, tmp);
}
}
return partials;
}
} // namespace csm