GeoTessCPP
2.2
Software to facilitate storage and retrieval of 3D information about the Earth.
|
Information about an interpolated point at an arbitrary position in a model. More...
#include <GeoTessPosition.h>
Public Member Functions | |
virtual | ~GeoTessPosition () |
Destructor. More... | |
void | addReference () |
Add reference count;. More... | |
void | copyVector (double *u) |
Copy the contents of the unit vector that corresponds to the current position into the supplied double* which must have at least 3 elements. More... | |
const double * | getClosestVertex () const |
Retrieve the unit vector of the vertex wiht the highest interpolation coefficient. More... | |
void | getCoefficients (map< int, double > &coefficients) |
Retrieve a map from pointIndex to interpolation coefficient. More... | |
double | getDepth () |
Retrieve the depth of the current position in km. More... | |
double | getDepthBottom () |
Retrieve an interpolated value of the depth of the bottom of the current layer. More... | |
double | getDepthBottom (int layid) |
Retrieve an interpolated value of the depth of the bottom of the current layer. More... | |
double | getDepthTop () |
Retrieve an interpolated value of the depth of the top of the current layer. More... | |
double | getDepthTop (int layid) |
Retrieve an interpolated value of the depth of the top of the current layer. More... | |
double | getEarthRadius () |
Retrieve the radius of the Earth at this position, in km. More... | |
double | getErrorValue () |
If any calculated value is Double.NaN, then functions like getValue() or getRadiusTop() or getRadiusBottom() will return this errorValue. More... | |
double | getHorizontalCoefficient (int index) const |
Retrieve the interpolation coefficient associated with one of the vertices of the tessellation used to interpolate data. More... | |
const vector< double > & | getHorizontalCoefficients () const |
Retrieve a reference to the horizontal interpolation coefficients associated with the vertices of the tessellation used to interpolate data. More... | |
int | getIndexOfClosestVertex () const |
Retrieve the index of the highest interpolation coefficient. More... | |
virtual const GeoTessInterpolatorType & | getInterpolatorType () const |
Retrieve the type of interpolator being used for interpolation in geographic dimensions. More... | |
int | getLayerId (double rad) |
Retrieve the index of the layer that contains the specified radius. More... | |
int | getLayerId () |
double | getLayerThickness (int layid) |
Retrieve the thickness of specified layer, in km. More... | |
double | getLayerThickness () |
Retrieve the thickness of specified layer, in km. More... | |
int | getMaxTessLevel (int layid) |
Retrieve the current value of maxTessLevel, which is the maximum tessellation level such that the triangle that is found during a walking triangle search will be on a tessellation level that is no higher than the specified value. More... | |
virtual long | getMemory () |
Retrieve the amount of memory consumed by this GeoTessPosition object. More... | |
GeoTessModel * | getModel () |
int | getNVertices () |
Return the number of vertices (3 for LINEAR interpolation, more for natural neighbor). More... | |
double | getRadius () |
Retrieve the radius of the current position, in km. More... | |
double | getRadiusBottom (int layid) |
Retrieve an interpolated value of the radius of the bottom of the specified layer, in km. More... | |
double | getRadiusBottom () |
Retrieve an interpolated value of the radius of the bottom of the current layer. More... | |
double | getRadiusTop (int layid) |
Retrieve an interpolated value of the radius of the top of the specified layer, in km. More... | |
double | getRadiusTop () |
Retrieve an interpolated value of the radius of the top of the current layer. More... | |
int | getReferenceCount () |
Retrieve reference count - number of other objects that hold a reference to this position object. More... | |
int | getTessID () |
int | getTessLevel () const |
Retrieve the index of the tessellation level of the triangle that was found the last time that the walinkg triangle algorithm was executed. More... | |
int | getTessLevel (const int &tId) |
Retrieve the index of the tessellation level of the triangle that was found the last time that the walking triangle algorithm was executed. More... | |
int | getTriangle () |
Retrieve the index of the triangle within which the current position is located. More... | |
virtual double | getValue (int attribute) |
Retrieve an interpolated value of the specified model attribute. More... | |
double * | getVector () |
Retrieve a reference to the 3 component unit vector that corresponds to the current position. More... | |
int | getVertex (int index) |
Return the index of one of the vertices used to interpolate data. More... | |
int | getVertexIndex () |
If the position of this GeoTessPosition object is currently set to a location that coincides with one of the grid vertices, return the index of that vertex. More... | |
const vector< int > & | getVertices () const |
Return a reference to the array containing the indexes of vertices in the 2D grid that will be involved in the interpolation of data. More... | |
void | getWeights (map< int, double > &weights, double dkm) |
Add the weights of the current interpolation position to the supplied map of weights. More... | |
bool | isNotReferenced () |
Returns true if reference count is zero. More... | |
bool | isRadiusOutOfRangeAllowed () |
Controls radius out-of-range behavior. More... | |
bool | noEmptyProfiles () |
Returns true if the current interpolation position has no empty profiles. More... | |
void | removeReference () |
Remove reference count;. More... | |
void | set (double lat, double lon, double depth) |
Set the interpolation point to specified latitude and and longitude in degrees and depth in km below sea level. More... | |
void | set (const double *const uVector, const double &newRadius) |
Set the interpolation point. More... | |
void | set (int layid, double lat, double lon, double depth) |
Set the interpolation point to specified latitude and longitude in degrees and depth in km below sea level. More... | |
void | set (int layid, const double *const uVector, double rad) |
Set the interpolation point. More... | |
void | setBottom (int layid, const double *const uVector) |
Set the 2D position to unitVector and radius to the radius of the bottom of the specified layer. More... | |
void | setBottom (int layid) |
Set the radius to the radius of the bottom of the specified layer. More... | |
void | setDepth (int layer, double depth) |
Change the current layer and/or depth without changing the geographic position. More... | |
void | setDepth (double depth) |
Change the current depth without changing the geographic position. More... | |
void | setErrorValue (double errVal) |
If any calculated value is NaN, then functions like getValue() or getRadiusTop() or getRadiusBottom() will return this value. More... | |
void | setMaxTessLevel (int layid, int maxTess) |
Set the maximum tessellation level such that the triangle that is found during a walking triangle search will be on a tessellation level that is no higher than the specified value. More... | |
void | setModel (GeoTessModel *newModel) |
Replace the model that currently supports this GeoTessPosition object with a new model. More... | |
void | setRadius (int layid, double rad) |
Change the current radius without changing the geographic position. More... | |
void | setRadius (double rad) |
Change the current radius without changing the geographic position. More... | |
void | setRadiusOutOfRangeAllowed (bool allowed) |
Controls radius out-of-range behavior. More... | |
void | setTop (int layid, const double *const uVector) |
Set the 2D position to unitVector and radius to the radius of the top of the specified layer. More... | |
void | setTop (int layid) |
Set the radius to the radius of the top of the specified layer. More... | |
string | toString () |
Returns position as a string. More... | |
Static Public Member Functions | |
static GeoTessPosition * | getGeoTessPosition (GeoTessModel *model) |
Static factory method to create a new GeoTessPosition object. More... | |
static GeoTessPosition * | getGeoTessPosition (GeoTessModel *model, const GeoTessInterpolatorType &horizontalType) |
Static factory method to create a new GeoTessPosition object. More... | |
static GeoTessPosition * | getGeoTessPosition (GeoTessModel *model, const GeoTessInterpolatorType &horizontalType, const GeoTessInterpolatorType &radialType) |
Static factory method to create a new GeoTessPosition object. More... | |
Information about an interpolated point at an arbitrary position in a model.
Manages information about a single point at an arbitrary position in a triangular tessellation. It provides access to:
GeoTessModel has method getGeoTessPosition() that returns a pointer to a new GeoTessPosition object.
GeoTessPosition supports separate interpolation algorithms in the geographic and radial dimensions. In the geographic dimensions, LINEAR and NATURAL_NEIGHBOR interpolation algorithms are supported. LINEAR and CUBIC_SPLINE interpolation are supported in the radial dimension.
GeoTessPosition is not thread-safe in that it's internal state is mutable. The design intention is that single instances of a GeoTessGrid object and GeoTessData object can be shared among all the threads in a multi-threaded application and each thread will have it's own instance of a GeoTessPosition object that references the common GeoTessGrid + GeoTessData combination.
|
virtual |
Destructor.
|
inline |
Add reference count;.
|
inline |
Copy the contents of the unit vector that corresponds to the current position into the supplied double* which must have at least 3 elements.
u | a 3-element array into which the current position will be copied. |
|
inline |
Retrieve the unit vector of the vertex wiht the highest interpolation coefficient.
|
inline |
Retrieve a map from pointIndex to interpolation coefficient.
The returned coefficients sum to one.
coefficients | HashMap<Integer, Double> from pointIndex to interpolation coefficient |
|
inline |
Retrieve the depth of the current position in km.
Assumes GRS80 ellipsoid.
|
inline |
Retrieve an interpolated value of the depth of the bottom of the current layer.
|
inline |
Retrieve an interpolated value of the depth of the bottom of the current layer.
layid |
|
inline |
Retrieve an interpolated value of the depth of the top of the current layer.
|
inline |
Retrieve an interpolated value of the depth of the top of the current layer.
layid |
|
inline |
Retrieve the radius of the Earth at this position, in km.
Assumes GRS80 ellipsoid.
|
inline |
If any calculated value is Double.NaN, then functions like getValue() or getRadiusTop() or getRadiusBottom() will return this errorValue.
The default is NaN, but it can be set by calling setErrorValue();
|
static |
Static factory method to create a new GeoTessPosition object.
Linear interpolation will be performed in both the horizontal and radial dimensions.
It is the caller's responsibility to delete this object when it is no longer needed.
model | pointer to the model that supports this position |
|
static |
Static factory method to create a new GeoTessPosition object.
If the horizontal InterpolatorType is LINEAR then the radial InterpolatorType will be LINEAR as well. If the horizontal InterpolatorType is NATUAL_NEIGHBOR then the radial InterpolatorType will be CUBIC_SPLINE.
It is the caller's responsibility to delete this object when it is no longer needed.
model | the GeoTessModel from which values will be interpolated. |
horizontalType | the type of interpolation that is to be used for interpolation in the geographic dimensions; either InterpolatorType:LINEAR or InterpolatorType::NATURAL_NEIGHBOR |
|
static |
Static factory method to create a new GeoTessPosition object.
It is the caller's responsibility to delete this object when it is no longer needed.
model | the GeoTessModel from which values will be interpolated. |
horizontalType | the type of interpolation that is to be used for interpolation in the geographic dimensions; either InterpolatorType:LINEAR or InterpolatorType::NATURAL_NEIGHBOR |
radialType | the type of interpolation that is to be used in the radia dimension; either InterpolatorType:LINEAR or InterpolatorType::CUBIC_SPLINE |
|
inline |
Retrieve the interpolation coefficient associated with one of the vertices of the tessellation used to interpolate data.
index | the index of the desired coefficient. |
|
inline |
Retrieve a reference to the horizontal interpolation coefficients associated with the vertices of the tessellation used to interpolate data.
int geotess::GeoTessPosition::getIndexOfClosestVertex | ( | ) | const |
Retrieve the index of the highest interpolation coefficient.
|
virtual |
Retrieve the type of interpolator being used for interpolation in geographic dimensions.
Reimplemented in geotess::GeoTessPositionNaturalNeighbor, and geotess::GeoTessPositionLinear.
|
inline |
Retrieve the index of the layer that contains the specified radius.
If radius is less than bottom of model, returns 0. If radius greater than top of model, returns index of shallowest layer that has finite thickness. If radius greater than top of model and all layers have zero thickness, returns nLayers-1.
rad | radius in km |
|
inline |
|
inline |
Retrieve the thickness of specified layer, in km.
layid | layer index |
|
inline |
Retrieve the thickness of specified layer, in km.
|
inline |
Retrieve the current value of maxTessLevel, which is the maximum tessellation level such that the triangle that is found during a walking triangle search will be on a tessellation level that is no higher than the specified value.
Default value is Integer.maxValue-1.
layid |
|
virtual |
Retrieve the amount of memory consumed by this GeoTessPosition object.
Reimplemented in geotess::GeoTessPositionNaturalNeighbor, and geotess::GeoTessPositionLinear.
|
inline |
|
inline |
Return the number of vertices (3 for LINEAR interpolation, more for natural neighbor).
|
inline |
Retrieve the radius of the current position, in km.
double geotess::GeoTessPosition::getRadiusBottom | ( | int | layid | ) |
Retrieve an interpolated value of the radius of the bottom of the specified layer, in km.
layid | the index of the layer |
|
inline |
Retrieve an interpolated value of the radius of the bottom of the current layer.
double geotess::GeoTessPosition::getRadiusTop | ( | int | layid | ) |
Retrieve an interpolated value of the radius of the top of the specified layer, in km.
layid | the index of the layer |
|
inline |
Retrieve an interpolated value of the radius of the top of the current layer.
|
inline |
Retrieve reference count - number of other objects that hold a reference to this position object.
|
inline |
|
inline |
Retrieve the index of the tessellation level of the triangle that was found the last time that the walinkg triangle algorithm was executed.
|
inline |
Retrieve the index of the tessellation level of the triangle that was found the last time that the walking triangle algorithm was executed.
tId | tessellation index |
|
inline |
Retrieve the index of the triangle within which the current position is located.
|
virtual |
Retrieve an interpolated value of the specified model attribute.
attribute | index |
|
inline |
Retrieve a reference to the 3 component unit vector that corresponds to the current position.
Do not modify the values of this array.
|
inline |
Return the index of one of the vertices used to interpolate data.
index | the index of the desired coefficient. |
|
inline |
If the position of this GeoTessPosition object is currently set to a location that coincides with one of the grid vertices, return the index of that vertex.
Otherwise return -1;
|
inline |
Return a reference to the array containing the indexes of vertices in the 2D grid that will be involved in the interpolation of data.
|
inline |
Add the weights of the current interpolation position to the supplied map of weights.
Weights is a map from a pointIndex to the 'weight' associated with that point. For an individual point, the weight associated with that point is the product of the interpoation coefficient times the supplied value of dkm.
weights | a map from a point index to the weight assigned to that point. |
dkm | the 'length' in km associated with each interpolation position. |
|
inline |
Returns true if reference count is zero.
|
inline |
Controls radius out-of-range behavior.
If position or radius is set with a specified layer index, and a radius is specified that is outside the bounds of that layer, and radiusOutOfRangeAllowed is true, then interpolated values will be computed using the values from the top or bottom of the specified layer as appropriate. If radiusOutOfRangeAllowed is false then errorValue is returned.
If position or radius is set without a specified layer index, and a radius is specified that is above the surface of the Earth, and radiusOutOfRangeAllowed is true, then interpolated values will be computed using the values from the top of the shallowest layer that has finite thickness. If radiusOutOfRangeAllowed is false then errorValue is returned.
bool geotess::GeoTessPosition::noEmptyProfiles | ( | ) |
Returns true if the current interpolation position has no empty profiles.
|
inline |
Remove reference count;.
|
inline |
Set the interpolation point to specified latitude and and longitude in degrees and depth in km below sea level.
This method will perform a walking triangle search for the triangle in which the specified position is located and compute the associated interpolation coefficients.
This method is pretty expensive compared to the other version of setPosition where the position is specified as a unit vector and a radius.
Assumes GRS80 ellipsoid.
lat | in degrees. |
lon | in degrees. |
depth | below sea level in km. |
|
inline |
Set the interpolation point.
This method will perform a walking triangle search for the triangle in which the specified position is located and compute the associated 2D and radial interpolation coefficients.
uVector | the Earth-centered unit vector that defines the position that is to be set. |
newRadius | the radius of the position, in km. |
|
inline |
Set the interpolation point to specified latitude and longitude in degrees and depth in km below sea level.
This method will perform a walking triangle search for the triangle in which the specified position is located and compute the associated interpolation coefficients.
This method is pretty expensive compared to the other version of setPosition where the position is specified as a unit vector and a radius.
Assumes GRS80 ellipsoid.
layid | the index of the layer of the model in which the position is to be constrained. |
lat | in degrees. |
lon | in degrees. |
depth | below sea level in km. |
|
inline |
Set the interpolation point.
This method will perform a walking triangle search for the triangle in which the specified position is located and compute the associated 2D and radial interpolation coefficients.
layid | the index of the layer of the model in which the position is to be constrained. |
uVector | the Earth-centered unit vector that defines the position that is to be set. |
rad | the radius of the position, in km. |
|
inline |
Set the 2D position to unitVector and radius to the radius of the bottom of the specified layer.
layid | the index of the layer of the model in which the position is located. |
uVector | the Earth-centered unit vector that defines the position that is to be set. |
|
inline |
Set the radius to the radius of the bottom of the specified layer.
layid | the index of the layer of the model in which the position is located. |
|
inline |
Change the current layer and/or depth without changing the geographic position.
layer | the index of the layer of the model in which the position is located. |
depth |
|
inline |
Change the current depth without changing the geographic position.
depth | depth in km. |
|
inline |
If any calculated value is NaN, then functions like getValue() or getRadiusTop() or getRadiusBottom() will return this value.
The default is NaN, but it can be set by calling this function.
errVal | new value for errVal |
|
inline |
Set the maximum tessellation level such that the triangle that is found during a walking triangle search will be on a tessellation level that is no higher than the specified value.
Default value is Integer.maxValue.
layid | |
maxTess |
void geotess::GeoTessPosition::setModel | ( | GeoTessModel * | newModel | ) |
Replace the model that currently supports this GeoTessPosition object with a new model.
For this to work, the new model and the current model must use the same grid.
The benefit of calling this method is that if the application needs to interpolate a value at the same position in multiple models that share the same grid, then the walking triangle algorithm and the calculation of geographic interpolation coefficients do not have to be repeated. The radial interpolation information is updated by this method as well so after the call to this method, GeoTessPosition is ready to interpolate values from the new model.
newModel | model that is to replace the currently supported model. |
GeoTessException | if the new model and current model do not have GeoTessGrids that have the same gridID. |
|
inline |
Change the current radius without changing the geographic position.
layid | the index of the layer of the model in which the position is located. |
rad | the new radius in km |
|
inline |
Change the current radius without changing the geographic position.
rad | the new radius in km |
|
inline |
Controls radius out-of-range behavior.
If position or radius is set with a specified layer index, and a radius is specified that is outside the bounds of that layer, and radiusOutOfRangeAllowed is true, then interpolated values will be computed using the values from the top or bottom of the specified layer as appropriate. If radiusOutOfRangeAllowed is false then errorValue is returned.
If position or radius is set without a specified layer index, and a radius is specified that is above the surface of the Earth, and radiusOutOfRangeAllowed is true, then interpolated values will be computed using the values from the top of the shallowest layer that has finite thickness. If radiusOutOfRangeAllowed is false then errorValue is returned.
allowed | the new value for radiusOutOfRangeAllowed |
|
inline |
Set the 2D position to unitVector and radius to the radius of the top of the specified layer.
layid | the index of the layer of the model in which the position is located. |
uVector | the Earth-centered unit vector that defines the position that is to be set. |
|
inline |
Set the radius to the radius of the top of the specified layer.
layid | the index of the layer of the model in which the position is located. |
string geotess::GeoTessPosition::toString | ( | ) |
Returns position as a string.