GeoTessCPP
2.0.0
Software to facilitate storage and retrieval of 3D information about the Earth.
|
00001 //- **************************************************************************** 00002 //- 00003 //- Copyright 2009 Sandia Corporation. Under the terms of Contract 00004 //- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 00005 //- retains certain rights in this software. 00006 //- 00007 //- BSD Open Source License. 00008 //- All rights reserved. 00009 //- 00010 //- Redistribution and use in source and binary forms, with or without 00011 //- modification, are permitted provided that the following conditions are met: 00012 //- 00013 //- * Redistributions of source code must retain the above copyright notice, 00014 //- this list of conditions and the following disclaimer. 00015 //- * Redistributions in binary form must reproduce the above copyright 00016 //- notice, this list of conditions and the following disclaimer in the 00017 //- documentation and/or other materials provided with the distribution. 00018 //- * Neither the name of Sandia National Laboratories nor the names of its 00019 //- contributors may be used to endorse or promote products derived from 00020 //- this software without specific prior written permission. 00021 //- 00022 //- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 //- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 //- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 //- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00026 //- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00027 //- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00028 //- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 //- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00030 //- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00031 //- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 //- POSSIBILITY OF SUCH DAMAGE. 00033 //- 00034 //- **************************************************************************** 00035 00036 #ifndef GEOTESSPOSITIONLINEAR_OBJECT_H 00037 #define GEOTESSPOSITIONLINEAR_OBJECT_H 00038 00039 // **** _SYSTEM INCLUDES_ ****************************************************** 00040 00041 #include <iostream> 00042 #include <string> 00043 #include <fstream> 00044 #include <vector> 00045 00046 // use standard library objects 00047 using namespace std; 00048 00049 // **** _LOCAL INCLUDES_ ******************************************************* 00050 00051 #include "CPPUtils.h" 00052 #include "GeoTessUtils.h" 00053 #include "GeoTessPosition.h" 00054 #include "GeoTessGrid.h" 00055 #include "GeoTessInterpolatorType.h" 00056 00057 // **** _BEGIN GEOTESS NAMESPACE_ ********************************************** 00058 00059 namespace geotess 00060 { 00061 00062 // **** _FORWARD REFERENCES_ *************************************************** 00063 00064 class GeoTessModel; 00065 00066 // **** _CLASS DEFINITION_ ***************************************************** 00067 00076 class GEOTESS_EXP_IMP GeoTessPositionLinear: public GeoTessPosition 00077 { 00078 protected: 00079 00086 virtual void update2D(int tid) 00087 { 00088 vector<int>& vt = vertices[tid]; 00089 vector<double>& hc = hCoefficients[tid]; 00090 00091 vt.clear(); 00092 hc.clear(); 00093 00094 const int* trngl = grid.getTriangleVertexIndexes(getTriangle(tid)); 00095 00096 // if the interpolation point falls on a grid node set the list of interpolation 00097 // vertices to include only the identified vertex, and the interpolation coefficient = 1. 00098 if (GeoTessUtils::dot(unitVector, grid.getVertex(trngl[0])) > cos(1e-7)) 00099 { vt.push_back(trngl[0]); hc.push_back(1.0); return; } 00100 00101 if (GeoTessUtils::dot(unitVector, grid.getVertex(trngl[1])) > cos(1e-7)) 00102 { vt.push_back(trngl[1]); hc.push_back(1.0); return; } 00103 00104 if (GeoTessUtils::dot(unitVector, grid.getVertex(trngl[2])) > cos(1e-7)) 00105 { vt.push_back(trngl[2]); hc.push_back(1.0); return; } 00106 00107 // interpolation point is not coincident with a grid node. 00108 vector<double>& lc = linearCoefficients[tid]; 00109 vt.push_back(trngl[0]); 00110 hc.push_back(lc[0]); 00111 vt.push_back(trngl[1]); 00112 hc.push_back(lc[1]); 00113 vt.push_back(trngl[2]); 00114 hc.push_back(lc[2]); 00115 } 00116 00117 public: 00118 00122 GeoTessPositionLinear(GeoTessModel* model, 00123 const GeoTessInterpolatorType& radialType); 00124 00128 virtual ~GeoTessPositionLinear(); 00129 00134 virtual const GeoTessInterpolatorType& getInterpolatorType() const 00135 { 00136 return GeoTessInterpolatorType::LINEAR; 00137 } 00138 ; 00139 00140 }; 00141 // end class GeoTessModelLinear 00142 00143 }// end namespace geotess 00144 00145 #endif // GEOTESSPOSITIONLINEAR_OBJECT_H