GeoTessCPP  2.2
Software to facilitate storage and retrieval of 3D information about the Earth.
GeoTessPositionLinear.h
Go to the documentation of this file.
1 //- ****************************************************************************
2 //-
3 //- Copyright 2009 Sandia Corporation. Under the terms of Contract
4 //- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
5 //- retains certain rights in this software.
6 //-
7 //- BSD Open Source License.
8 //- All rights reserved.
9 //-
10 //- Redistribution and use in source and binary forms, with or without
11 //- modification, are permitted provided that the following conditions are met:
12 //-
13 //- * Redistributions of source code must retain the above copyright notice,
14 //- this list of conditions and the following disclaimer.
15 //- * Redistributions in binary form must reproduce the above copyright
16 //- notice, this list of conditions and the following disclaimer in the
17 //- documentation and/or other materials provided with the distribution.
18 //- * Neither the name of Sandia National Laboratories nor the names of its
19 //- contributors may be used to endorse or promote products derived from
20 //- this software without specific prior written permission.
21 //-
22 //- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 //- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 //- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 //- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26 //- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 //- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 //- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 //- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 //- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 //- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 //- POSSIBILITY OF SUCH DAMAGE.
33 //-
34 //- ****************************************************************************
35 
36 #ifndef GEOTESSPOSITIONLINEAR_OBJECT_H
37 #define GEOTESSPOSITIONLINEAR_OBJECT_H
38 
39 // **** _SYSTEM INCLUDES_ ******************************************************
40 
41 #include <iostream>
42 #include <string>
43 #include <fstream>
44 #include <vector>
45 
46 // use standard library objects
47 using namespace std;
48 
49 // **** _LOCAL INCLUDES_ *******************************************************
50 
51 #include "CPPUtils.h"
52 #include "GeoTessUtils.h"
53 #include "GeoTessPosition.h"
54 #include "GeoTessGrid.h"
56 
57 // **** _BEGIN GEOTESS NAMESPACE_ **********************************************
58 
59 namespace geotess
60 {
61 
62 // **** _FORWARD REFERENCES_ ***************************************************
63 
64 class GeoTessModel;
65 
66 // **** _CLASS DEFINITION_ *****************************************************
67 
77 {
78 protected:
79 
86  virtual void update2D(int tid)
87  {
88  vector<int>& vt = vertices[tid];
89  vector<double>& hc = hCoefficients[tid];
90 
91  vt.clear();
92  hc.clear();
93 
94  const int* trngl = grid.getTriangleVertexIndexes(getTriangle(tid));
95 
96  // if the interpolation point falls on a grid node set the list of interpolation
97  // vertices to include only the identified vertex, and the interpolation coefficient = 1.
98  if (GeoTessUtils::dot(unitVector, grid.getVertex(trngl[0])) > cos(1e-7))
99  { vt.push_back(trngl[0]); hc.push_back(1.0); return; }
100 
101  if (GeoTessUtils::dot(unitVector, grid.getVertex(trngl[1])) > cos(1e-7))
102  { vt.push_back(trngl[1]); hc.push_back(1.0); return; }
103 
104  if (GeoTessUtils::dot(unitVector, grid.getVertex(trngl[2])) > cos(1e-7))
105  { vt.push_back(trngl[2]); hc.push_back(1.0); return; }
106 
107  // interpolation point is not coincident with a grid node.
108  vector<double>& lc = linearCoefficients[tid];
109  vt.push_back(trngl[0]);
110  hc.push_back(lc[0]);
111  vt.push_back(trngl[1]);
112  hc.push_back(lc[1]);
113  vt.push_back(trngl[2]);
114  hc.push_back(lc[2]);
115 }
116 
117 public:
118 
123  const GeoTessInterpolatorType& radialType);
124 
128  virtual ~GeoTessPositionLinear();
129 
134  virtual const GeoTessInterpolatorType& getInterpolatorType() const { return GeoTessInterpolatorType::LINEAR; }
135 
136  virtual long getMemory() { return (long) sizeof(GeoTessPositionLinear) + memory(); }
137 
138 };
139 // end class GeoTessModelLinear
140 
141 }// end namespace geotess
142 
143 #endif // GEOTESSPOSITIONLINEAR_OBJECT_H
Information about an interpolated point at an arbitrary position in a model.
Definition: GeoTessPosition.h:101
Definition: ArrayReuse.h:55
Enumeration of the interpolation algorithms supported by GeoTess including LINEAR, NATURAL_NEIGHBOR and CUBIC_SPLINE.
Definition: GeoTessInterpolatorType.h:71
virtual void update2D(int tid)
Set vertices to the 3-element array that stores the corners of the triangle identified during the tri...
Definition: GeoTessPositionLinear.h:86
virtual const GeoTessInterpolatorType & getInterpolatorType() const
Retrieve the type of interpolation that this GeoTessPosition object is configured to perform...
Definition: GeoTessPositionLinear.h:134
Top level class that manages the GeoTessMetaData, GeoTessGrid and GeoTessData that comprise a 3D Eart...
Definition: GeoTessModel.h:119
Implements linear interpolation in geographic dimensions of a grid.
Definition: GeoTessPositionLinear.h:76
#define GEOTESS_EXP_IMP
Definition: CPPGlobals.h:71
virtual long getMemory()
Retrieve the amount of memory consumed by this GeoTessPosition object.
Definition: GeoTessPositionLinear.h:136