GeoTessCPP 2.6.1 Software to facilitate storage and retrieval of 3D information about the Earth.

Loading...
Searching...
No Matches
geotess::GeoTessGrid Class Reference

Manages the geometry and topology of one or more multi-level triangular tessellations of a unit sphere. Has many functions to retrieve information about the grid but knows nothing about Data. More...

`#include <GeoTessGrid.h>`

## Public Member Functions
| GeoTessGrid ()
| GeoTessGrid (IFStreamAscii &input)
| GeoTessGrid (IFStreamBinary &input)
| GeoTessGrid (GeoTessGrid &other)
GeoTessGrid & | operator= (const GeoTessGrid &other)
LONG_INT | getMemory ()
GeoTessGrid * | loadGrid (const string &inputFile)
bool | operator== (const GeoTessGrid &g) const
bool | operator!= (const GeoTessGrid &g) const
const string & | getGridID () const
void | setGridSoftwareVersion (const string &swVersion)
const string & | getGridSoftwareVersion () const
void | setGridGenerationDate (const string &gridDate)
const string & | getGridGenerationDate () const
void | setGridInputFile (const string &gridFile)
const string & | getGridInputFile () const
const string & | getGridOutputFile () const
const double * | getVertex (int vertex) const
int | findClosestVertex (double *unit_vector, int tessId)
int | getVertexIndex (int triangle, int corner) const
int | getVertexIndex (int tessId, int level, int triangle, int corner) const
int | getVertexIndex (const double *u)
int | getVertexIndex (const double *u, int tessId)
double * | getVertex (int tessId, int level, int triangle, int corner)
double const *const * | getVertices () const
void | getVerticesTopLevel (const int &tessellation, set< const double * > &vectors)
void | getVertices (const int &tessellation, const int &level, set< const double * > &vectors)
const set< int > & | getVertexIndices (const int &tessId, const int &level)
const set< int > & | getVertexIndicesTopLevel (const int &tessId)
int | getNVertices () const
int | getNTessellations () const
int | getNLevels (int tessellation) const
int | getLevel (int tessellation, int i) const
int | getLastLevel (int tessellation) const
int | getTopLevel (int tessellation) const
int | getNTriangles (int tessellation, int level) const
int | getTriangle (int tessellation, int level, int i) const
int | getFirstTriangle (int tessellation, int level) const
int | getLastTriangle (int tessellation, int level) const
int const *const * | getTriangles () const
const int * | getTriangleVertexIndexes (int triangleIndex) const
int | getTriangleVertexIndex (int triangleIndex, int cornerIndex) const
const double * | getTriangleVertex (int triangleIndex, int cornerIndex) const
void | getTriangleVertices (int triangle, double **triVrt)
const void | computeCircumCenters ()
const void | computeCircumCenters (const int &level)
const double * | getCircumCenter (const int &triangle) const
void | getCircumCenter (const int &triangle, double *cc) const
int | getNeighbor (const int &triangleIndex, const int &neighborIndex) const
int | getNeighbor (const int &tessellation, const int &level, const int &triangle, const int &side)
void | getNeighbors (int triangleIndex, vector< int > &neighbors)
void | getNeighbors (const int &tessellation, const int &level, const int &triangle, vector< int > &neighbors)
int | getNeighborIndex (const int &tid, const int &nid)
int const * | getDescendants () const
int | getDescendant (const int &triangle) const
int | getDescendant (const int &tessId, const int &level, const int &triangle) const
string | toString ()
int | getTriangle (int triangleIndex, const double *vector)
const vector< vector< int > > & | getVertexTriangles (const int &level) const
const vector< int > & | getVertexTriangles (const int &tessId, const int &level, const int &vertex) const
const vector< int > & | getVertexTriangles (int tessId, int vertex) const
void | getVertexNeighborsOrdered (const int &tessId, const int &level, const int &vertex, vector< int > &v)
void | getVertexNeighbors (const int &tessId, const int &level, const int &vertex, set< int > &nbrs)
void | getVertexNeighbors (const int &tessId, const int &level, const int &vertex, const int &order, set< int > &nbrs)
void | testGrid ()
int | getNLevels () const
int const *const * | getLevels () const
int const *const * | getTessellations () const
int | getNTriangles () const
vector< Edge * > & | getSpokeList (const int &level) const
const vector< vector< Edge * > > & | getEdgeList () const
const vector< Edge * > & | getEdgeList (const int &triangle) const
void | getCenter (const int &triangle, double *center)
int | delaunay ()

## Static Public Member Functions
static string | getGridID (const string &fileName)
static bool | isGeoTessGrid (const string &inputFile)

## Protected Member Functions
void | initialize ()
| GeoTessGrid (const string &gid)

## Protected Attributes
double ** | vertices
int | nVertices
int ** | triangles
int | nTriangles
int ** | levels
int | nLevels
int ** | tessellations
int | nTessellations

## Detailed Description

Manages the geometry and topology of one or more multi-level triangular tessellations of a unit sphere. Has many functions to retrieve information about the grid but knows nothing about Data.

Manages the geometry and topology of one or more multi-level triangular tessellations of a unit sphere. It knows:

- the positions of all the vertices,
- the connectivity information that defines how vertices are connected to form triangles,
- for each triangle it knows the indexes of the 3 neighboring triangles,
- for each triangle it knows the index of the triangle which is a descendant at the next higher tessellation level, if there is one.
- information about which triangles reside on which tessellation level

GeoTessGrid is thread-safe in that its internal state is not modified after its data has been loaded into memory. 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.

References Ballard, S., J. R. Hipp and C. J. Young, 2009, Efficient and Accurate Calculation of Ray Theory Seismic Travel Time Through Variable Resolution 3D Earth Models, Seismological Research Letters, v.80, n. 6 p. 989-999.

Author
  Sandy Ballard

Definition at line 166 of file GeoTessGrid.h.

## Constructor & Destructor Documentation

## ◆ GeoTessGrid() [1/5]

geotess::GeoTessGrid::GeoTessGrid | ( | const string & | gid | ) |
| inline protected

Standard constructor. Builds this grid from the input file name.

Definition at line 244 of file GeoTessGrid.h.

## ◆ GeoTessGrid() [2/5]

geotess::GeoTessGrid::GeoTessGrid | ( |  | ) |
| inline

Default constructor. All grid information initialized to NULL. Applications need to call

Definition at line 410 of file GeoTessGrid.h.

## ◆ GeoTessGrid() [3/5]

geotess::GeoTessGrid::GeoTessGrid | ( | IFStreamAscii & | input | ) |
| inline

Standard constructor. Builds this grid from an ascii file.

Definition at line 423 of file GeoTessGrid.h.

## ◆ GeoTessGrid() [4/5]

geotess::GeoTessGrid::GeoTessGrid | ( | IFStreamBinary & | input | ) |
| inline

Standard constructor. Builds this grid from a binary file.

Definition at line 433 of file GeoTessGrid.h.

## ◆ GeoTessGrid() [5/5]

geotess::GeoTessGrid::GeoTessGrid | ( | GeoTessGrid & | other | ) |

Copy constructor. Makes a deep copy

Parameters

  other | the other GeoTessGrid whose values are to be duplicated here.

## Member Function Documentation

## ◆ computeCircumCenters() [1/2]

const void geotess::GeoTessGrid::computeCircumCenters | ( |  | ) |
| inline

Compute the circumcenters of all triangles if they have not already been computed.

Definition at line 1017 of file GeoTessGrid.h.

## ◆ computeCircumCenters() [2/2]

const void geotess::GeoTessGrid::computeCircumCenters | ( | const int & | level | ) |
| inline

Compute the circumcenters of all triangles on the specified level if they have not already been computed.

Definition at line 1034 of file GeoTessGrid.h.

## ◆ delaunay()

int geotess::GeoTessGrid::delaunay | ( |  | ) |

Convert tessellation to a Delaunay tessellation.

Returns
  number of changes.

## ◆ findClosestVertex()

int geotess::GeoTessGrid::findClosestVertex | ( | double * | unit_vector,
|  | int | tessId )
| inline

Retrieve the index of the vertex that is closest to the supplied unit vector. Only vertices connected at the specified tessellation index are searched.

Parameters

  unit_vector | a unit vector
  tessId | tessellation to search for the specified unit vector.

Returns
  index of closest vertex.

Definition at line 643 of file GeoTessGrid.h.

## ◆ getCenter()

void geotess::GeoTessGrid::getCenter | ( | const int & | triangle,
|  | double * | center )
| inline

Compute the unit vector that resides at the center of the specified triangle.

Parameters

  triangle | the index of the triangle
  center | unit vector that is populated with the location of the center of the specified triangle;

Definition at line 1530 of file GeoTessGrid.h.

## ◆ getCircumCenter() [1/2]

const double * geotess::GeoTessGrid::getCircumCenter | ( | const int & | triangle | ) | const
| inline

Retrieve the circumCenter of the specified triangle. The circumCenter of a triangle is the center of the circle that has all three corners of the triangle on its circumference.

The fourth element of returned circumcenter is the dot product of the new circumcenter with one of the vertices. In other words, cc[3] = cos(ccRadius).

This method will fail if method computeCircumCenters() has not already been called. computeCircumCenters() is called from the GeoTessPositionNaturalNeighbor constructor.

Parameters

  triangle | Triangle for which the circumcenter will be returned.

Returns
  unit vector that defines circumCenter. Fourth element is cos(ccRadius)

Definition at line 1064 of file GeoTessGrid.h.

## ◆ getCircumCenter() [2/2]

void geotess::GeoTessGrid::getCircumCenter | ( | const int & | triangle,
|  | double * | cc ) const
| inline

Copy the circumCenter of the specified triangle. The circumCenter of a triangle is the center of the circle that has all three corners of the triangle on its circumference.

The fourth element of returned circumcenter is the dot product of the new circumcenter with one of the vertices. In other words, cc[3] = cos(ccRadius).

This method will fail if method computeCircumCenters() has not already been called. computeCircumCenters() is called from the GeoTessPositionNaturalNeighbor constructor.

Parameters

  triangle | Triangle for which the circumcenter will be returned.
  cc | the 4-element array into which the circumCenter will be copied. The first three elements will get the unit vector that defines circumCenter. Fourth element will get cos(ccRadius)

Definition at line 1083 of file GeoTessGrid.h.

## ◆ getDescendant() [1/2]

int geotess::GeoTessGrid::getDescendant | ( | const int & | tessId,
|  | const int & | level,
|  | const int & | triangle ) const
| inline

Definition at line 1207 of file GeoTessGrid.h.

## ◆ getDescendant() [2/2]

int geotess::GeoTessGrid::getDescendant | ( | const int & | triangle | ) | const
| inline

Definition at line 1205 of file GeoTessGrid.h.

## ◆ getDescendants()

int const * geotess::GeoTessGrid::getDescendants | ( |  | ) | const
| inline

Definition at line 1203 of file GeoTessGrid.h.

## ◆ getEdgeList() [1/2]

const vector< vector< Edge * > > & geotess::GeoTessGrid::getEdgeList | ( |  | ) | const
| inline

Definition at line 1520 of file GeoTessGrid.h.

## ◆ getEdgeList() [2/2]

const vector< Edge * > & geotess::GeoTessGrid::getEdgeList | ( | const int & | triangle | ) | const
| inline

Definition at line 1522 of file GeoTessGrid.h.

## ◆ getFirstTriangle()

int geotess::GeoTessGrid::getFirstTriangle | ( | int | tessellation,
|  | int | level ) const
| inline

Retrieve the index of the first triangle on the specified level of the specified tessellation of the model.

Parameters

  tessellation |
  level | index of a level relative to the first level of the specified tessellation

Returns
  a triangle index

Definition at line 922 of file GeoTessGrid.h.

## ◆ getGridGenerationDate()

const string & geotess::GeoTessGrid::getGridGenerationDate | ( |  | ) | const
| inline

Retrieve the date when the contents of this grid was generated. This is not necessarily the same as the date when the file was copied or translated.

Returns
  the date when the contents of this grid was generated.

Definition at line 599 of file GeoTessGrid.h.

## ◆ getGridID() [1/2]

const string & geotess::GeoTessGrid::getGridID | ( |  | ) | const
| inline

A String ID that uniquely identifies this GeoTessGrid. It must be true that two GeoTessGrid objects that have different geometry or topology also have different uniqueID values. An MD5 hash of the primary data structures (tessellations, levels, triangles and vertices) would be an excellent choice for the uniqueId, but the uniqueId can be any String that uniquely identifies the grid.

Returns
  String gridID

Definition at line 564 of file GeoTessGrid.h.

## ◆ getGridID() [2/2]

string geotess::GeoTessGrid::getGridID | ( | const string & | fileName | ) |
| static

Open the specified file using the appropriate format, and read only enough of the file to retrieve the gridID.

Parameters

  fileName | name of file

Returns
  the grid id of the grid stored in the specified file.

## ◆ getGridInputFile()

const string & geotess::GeoTessGrid::getGridInputFile | ( |  | ) | const
| inline

Retrieve the name of the file from which the grid was loaded. This will be the name of a GeoTessModel file if the grid was stored in the same file as the model.

Returns
  the name of the file from which the grid was loaded.

Definition at line 614 of file GeoTessGrid.h.

## ◆ getGridOutputFile()

const string & geotess::GeoTessGrid::getGridOutputFile | ( |  | ) | const
| inline

Retrieve the name of the file to which this grid was most recently written, or the string "null" if it has not been written.

Returns
  the name of the file to which this grid was most recently written, or the string "null" if it has not been written.

Definition at line 623 of file GeoTessGrid.h.

## ◆ getGridSoftwareVersion()

const string & geotess::GeoTessGrid::getGridSoftwareVersion | ( |  | ) | const
| inline

Get the name and version number of the software that generated the contents of this grid.

Returns
  the name and version number of the software that generated the contents of this grid.

Definition at line 583 of file GeoTessGrid.h.

## ◆ getLastLevel()

int geotess::GeoTessGrid::getLastLevel | ( | int | tessellation | ) | const
| inline

Retrieve the index of the last level on the specified tessellation, relative to all levels in all tessellations.

Levels for all tessellations are stored internally in a single array of level indices. In some instances, the index of a level relative to all the levels in all tessellations is needed. Use this method, getLastLevel(tessId), to retrieve this index. In other instances, the index of a level relative to the first level of a specified tessellation is needed. Use method getTopLevel(tessid) to retrieve that index.

Parameters

  tessellation |

Returns
  the index of the last level on the specified tessellation relative to all levels of all tessellations.

Definition at line 864 of file GeoTessGrid.h.

## ◆ getLastTriangle()

int geotess::GeoTessGrid::getLastTriangle | ( | int | tessellation,
|  | int | level ) const
| inline

Retrieve the index of the last triangle on the specified level of the specified tessellation of the model.

Parameters

  tessellation |
  level | index of a level relative to the first level of the specified tessellation

Returns
  a triangle index

Definition at line 934 of file GeoTessGrid.h.

## ◆ getLevel()

int geotess::GeoTessGrid::getLevel | ( | int | tessellation,
|  | int | i ) const
| inline

Retrieve the index of one of the levels on the specified tessellation

Parameters

  tessellation |
  i | the index of the desired level relative to the first level on tessellation.

Returns
  the index of the level relative to all tessellation levels.

Definition at line 846 of file GeoTessGrid.h.

## ◆ getLevels()

int const *const * geotess::GeoTessGrid::getLevels | ( |  | ) | const
| inline

Retrieve a reference to all of the tessellation levels. Levels consists of an nLevels x 2 array of ints. The int[2] array associated with each level is the first ([0]) and last ([1]) + 1 index of the triangles on the level.

Users should not modify the contents of the array.

Returns
  nLevels x 2 array of unit triangle start and end indices for each tessellation.

Definition at line 1490 of file GeoTessGrid.h.

## ◆ getMemory()

LONG_INT geotess::GeoTessGrid::getMemory | ( |  | ) |
| inline

Retrieve the amount of memory required by this GeoTessGrid object in bytes.

Returns
  the amount of memory required by this GeoTessGrid object in bytes.

Definition at line 457 of file GeoTessGrid.h.

## ◆ getNeighbor() [1/2]

int geotess::GeoTessGrid::getNeighbor | ( | const int & | tessellation,
|  | const int & | level,
|  | const int & | triangle,
|  | const int & | side )
| inline

Retrieve the index of the triangle that is the i'th neighbor of the specified triangle. A triangle has at least 3 neighbors and usually has

1. For triangle T, neighbors 0, 1, and 2 reside on the same tessellation level as T and refer to the triangles that share an edge with T. If T has a fourth neighbor it is a descendent of T and resides on the next higher tessellation level relative to T. In other words, neighbor(3) is one of the triangles into which T was subdivided when the tessellation was constructed. If T does not have a descendant, then getNeighbor(3) will return -1. getNeighbor(i) will always return a valid triangle index for i=[0,1,2] but may or may not return a valid triangle index for i=3.

Parameters

  tessellation | tessellation index
  level | index of a level relative to the first level of the specified tessellation
  triangle | the i'th triangle in the specified tessellation/level
  side | the index of the triangle side (0..2)

Returns
  the index of the triangle that is the i'th neighbor of the specified triangle.

Definition at line 1127 of file GeoTessGrid.h.

## ◆ getNeighbor() [2/2]

int geotess::GeoTessGrid::getNeighbor | ( | const int & | triangleIndex,
|  | const int & | neighborIndex ) const
| inline

Retrieve the index of one of the triangles that is a neighbor of the specified triangle. A triangle has at least 3 neighbors and usually has 4. For triangle T, neighbors 0, 1, and 2 reside on the same tessellation level as T and refer to the triangles that share an edge with T. If T has a fourth neighbor it is a descendent of T and resides on the next higher tessellation level relative to T. In other words, neighbor(3) is one of the triangles into which T was subdivided when the tessellation was constructed. If T does not have a descendant, then getNeighbor(3) will return -1. getNeighbor(i) will always return a valid triangle index for i=[0,1,2] but may or may not return a valid triangle index for i=3.

Parameters

  triangleIndex | index of the triangle whose neighbor is desired.
  neighborIndex | (0..3)

Returns
  int index of the triangle that is a neighbor of triangle.

Definition at line 1100 of file GeoTessGrid.h.

## ◆ getNeighborIndex()

int geotess::GeoTessGrid::getNeighborIndex | ( | const int & | tid,
|  | const int & | nid )
| inline

If triangle with index tid has a neighbor with index nid, then return the index of neighbor in triangle's neighbor array.

In other words, if triangle nid is a neighbor of triangle tid, i.e., neighbors[tid][i] == nid, then this method returns i.

Parameters

  tid | the index of a triangle
  nid | the index of another triangle

Returns
  the index of neighbor in triangle's array of neighbors.

Definition at line 1192 of file GeoTessGrid.h.

## ◆ getNeighbors() [1/2]

void geotess::GeoTessGrid::getNeighbors | ( | const int & | tessellation,
|  | const int & | level,
|  | const int & | triangle,
|  | vector< int > & | neighbors )
| inline

Retrieve the indexes of the triangles that are neighbors of the specified triangle. A triangle has at least 3 neighbors and usually has 4. For triangle T, neighbors 0, 1, and 2 reside on the same tessellation level as T and refer to the triangles that share an edge with T. If T has a fourth neighbor it is a descendent of T and resides on the next higher tessellation level relative to T. In other words, neighbor(3) is one of the triangles into which T was subdivided when the tessellation was constructed. If T does not have a descendant, then getNeighbor(3) will return -1. getNeighbor(i) will always return a valid triangle index for i=[0,1,2] but may or may not return a valid triangle index for i=3.

Parameters

  tessellation | tessellation index
  level | index of a level relative to the first level of the specified tessellation
  triangle | the i'th triangle in the specified tessellation/level
  neighbors | an array that will be cleared and populated with the three triangle neighbors and the descendant of the supplied triangle.

Definition at line 1176 of file GeoTessGrid.h.

## ◆ getNeighbors() [2/2]

void geotess::GeoTessGrid::getNeighbors | ( | int | triangleIndex,
|  | vector< int > & | neighbors )
| inline

Retrieve the indexes of the triangles that are neighbors of the specified triangle. A triangle has at least 3 neighbors and usually has 4. For triangle T, neighbors 0, 1, and 2 reside on the same tessellation level as T and refer to the triangles that share an edge with T. If T has a fourth neighbor it is a descendent of T and resides on the next higher tessellation level relative to T. In other words, neighbor(3) is one of the triangles into which T was subdivided when the tessellation was constructed. If T does not have a descendant, then getNeighbor(3) will return -1. getNeighbor(i) will always return a valid triangle index for i=[0,1,2] but may or may not return a valid triangle index for i=3.

Parameters

  triangleIndex | index of the triangle whose neighbors are desired.
  neighbors | an array that will be cleared and populated with the three triangle neighbors and the descendant of the supplied triangle.

Definition at line 1144 of file GeoTessGrid.h.

## ◆ getNLevels() [1/2]

int geotess::GeoTessGrid::getNLevels | ( |  | ) | const
| inline

Returns the number of tessellation levels defined for this grid.

Returns
  The number of tessellation levels defined for this grid.

Definition at line 1477 of file GeoTessGrid.h.

## ◆ getNLevels() [2/2]

int geotess::GeoTessGrid::getNLevels | ( | int | tessellation | ) | const
| inline

Retrieve number of tessellation levels that define the specified multi-level tessellation of the model.

Parameters

  tessellation |

Returns
  number of levels

Definition at line 835 of file GeoTessGrid.h.

## ◆ getNTessellations()

int geotess::GeoTessGrid::getNTessellations | ( |  | ) | const
| inline

Returns the number of tessellations in the tessellations array.

Returns
  the number of multi-level tesseallations.

Definition at line 826 of file GeoTessGrid.h.

## ◆ getNTriangles() [1/2]

int geotess::GeoTessGrid::getNTriangles | ( |  | ) | const
| inline

Retrieve the total number of triangles including those on all levels of all tessellations.

Returns
  the total number of triangles including those on all levels of all tessellations.

Definition at line 1515 of file GeoTessGrid.h.

## ◆ getNTriangles() [2/2]

int geotess::GeoTessGrid::getNTriangles | ( | int | tessellation,
|  | int | level ) const
| inline

Retrieve the number of triangles that define the specified level of the specified multi-level tessellation of the model.

Parameters

  tessellation |
  level | index of a level relative to the first level of the specified tessellation

Returns
  number of triangles on specified tessellation and level.

Definition at line 893 of file GeoTessGrid.h.

## ◆ getNVertices()

int geotess::GeoTessGrid::getNVertices | ( |  | ) | const
| inline

Returns the number of vertices in the vectices array.

Returns
  number of vertices

Definition at line 820 of file GeoTessGrid.h.

## ◆ getSpokeList()

vector< Edge * > & geotess::GeoTessGrid::getSpokeList | ( | const int & | level | ) | const
| inline

Definition at line 1517 of file GeoTessGrid.h.

## ◆ getTessellations()

int const *const * geotess::GeoTessGrid::getTessellations | ( |  | ) | const
| inline

Retrieve a reference to all of the tessellations of this grid. Tessellations is a n x 2 int array where n is the number of tessellations in the topology of the model. Each element specifies [0] the index of the first level and [1] last level + 1 that make up the tessellation.

A tessellation is a multi-level tessellation of a unit sphere, which is to say that it is a hierarchical set of single-level tessellations (see 'levels' above).

Users should not modify the contents of the array.

Returns
  nLevels x 2 array of unit triangle start and end indices for each tessellation.

Definition at line 1506 of file GeoTessGrid.h.

## ◆ getTopLevel()

int geotess::GeoTessGrid::getTopLevel | ( | int | tessellation | ) | const
| inline

Retrieve the index of the last level on the specified tessellation, relative to first level of the specified tessellation.

Levels for all tessellations are stored internally in a single array of level indices. In some instances, the index of a level relative to the first level of a specified tessellation is needed. Use this method, getTopLevel(tessId), to retrieve this index. In other instances, the index of a level relative to all the levels in all tessellations is needed. Use method getLastLevel(tessid) to retrieve that index.

Parameters

  tessellation |

Returns
  the index of the last level on the specified tessellation relative to first level of the tessellation.

Definition at line 881 of file GeoTessGrid.h.

## ◆ getTriangle() [1/2]

int geotess::GeoTessGrid::getTriangle | ( | int | tessellation,
|  | int | level,
|  | int | i ) const
| inline

Retrieve the index of the i'th triangle on the specified level of the specified tessellation of the model.

Parameters

  tessellation |
  level | index of a level relative to the first level of the specified tessellation
  i |

Returns
  a triangle index

Definition at line 910 of file GeoTessGrid.h.

## ◆ getTriangle() [2/2]

int geotess::GeoTessGrid::getTriangle | ( | int | triangleIndex,
|  | const double * | vector )

Perform walking triangle search to find the index of the triangle that contains position defined by vector and which has no descendant.

Parameters

  triangleIndex | the triangle from which to start the search
  vector | the unit vector of the point that is to be searched for.

Returns
  the index of the triangle that contains vector

## ◆ getTriangles()

int const *const * geotess::GeoTessGrid::getTriangles | ( |  | ) | const
| inline

Retrieve a reference to the nTriangles x 3 array of int that specifies the indexes of the 3 vertices that define each triangle of the tessellation.

Users should not modify the contents of the array.

Returns
  a reference to the triangles.

Definition at line 946 of file GeoTessGrid.h.

## ◆ getTriangleVertex()

const double * geotess::GeoTessGrid::getTriangleVertex | ( | int | triangleIndex,
|  | int | cornerIndex ) const
| inline

Retrieve the unit vector of the vertex located at one of the corners of the specified triangle.

Parameters

  triangleIndex | triangleIndex
  cornerIndex | 0..2

Returns
  the unit vector of the vertex at the specified corner of the specified triangle

Definition at line 987 of file GeoTessGrid.h.

## ◆ getTriangleVertexIndex()

int geotess::GeoTessGrid::getTriangleVertexIndex | ( | int | triangleIndex,
|  | int | cornerIndex ) const
| inline

Retrieve the index of the i'th vertex (0..2) that represents one of the corners of the specified triangle.

Parameters

  triangleIndex | triangleIndex
  cornerIndex | 0..2

Returns
  the index of the vertex at the specified corner of the specified triangle

Definition at line 973 of file GeoTessGrid.h.

## ◆ getTriangleVertexIndexes()

const int * geotess::GeoTessGrid::getTriangleVertexIndexes | ( | int | triangleIndex | ) | const
| inline

Retrieve an int[3] array containing the indexes of the vertices that form the corners of the triangle with index triangleIndex.

Users should not modify the contents of the array.

Parameters

  triangleIndex | triangleIndex

Returns
  an int[3] array containing the indexes of the vertices that form the corners of the specified triangle.

Definition at line 959 of file GeoTessGrid.h.

## ◆ getTriangleVertices()

void geotess::GeoTessGrid::getTriangleVertices | ( | int | triangle,
|  | double ** | triVrt )
| inline

Get the 3 vertices that form the corners of the specified triangle, in clockwise order.

Parameters

  triangle | index of the desired triangle
  triVrt | the 3 vertices (unit vectors).

Returns
  3 x 3 array of doubles with the unit vectors that define the 3 corners of the specified triangle.

Definition at line 999 of file GeoTessGrid.h.

## ◆ getVertex() [1/2]

double * geotess::GeoTessGrid::getVertex | ( | int | tessId,
|  | int | level,
|  | int | triangle,
|  | int | corner )
| inline

Get the unit vector of the vertex that occupies the specified position in the hierarchy.

Parameters

  tessId | tessellation index
  level | index of a level relative to the first level of the specified tessellation
  triangle | the i'th triangle in the specified tessellation/level
  corner | the i'th corner of the specified tessellation/level/triangle

Returns
  unit vector of a vertex

Definition at line 747 of file GeoTessGrid.h.

## ◆ getVertex() [2/2]

const double * geotess::GeoTessGrid::getVertex | ( | int | vertex | ) | const
| inline

Retrieve the unit vector that corresponds to the specified vertex.

Parameters

  vertex | the index of the vertex

Returns
  unit vector of vertex

Definition at line 630 of file GeoTessGrid.h.

## ◆ getVertexIndex() [1/4]

int geotess::GeoTessGrid::getVertexIndex | ( | const double * | u | ) |
| inline

Retrieve the index of the vertex that is colocated with the supplied unit vector.

Parameters

  u | a unit vector

Returns
  index of colocated vertex, or -1 if there is no such vertex.

Definition at line 704 of file GeoTessGrid.h.

## ◆ getVertexIndex() [2/4]

int geotess::GeoTessGrid::getVertexIndex | ( | const double * | u,
|  | int | tessId )
| inline

Retrieve the index of the vertex that is colocated with the supplied unit vector. Only vertices connected at the specified tessellation index are searched.

Parameters

  u | a unit vector
  tessId | tessellation to search for the specified unit vector.

Returns
  index of colocated vertex, or -1 if there is no such vertex.

Definition at line 723 of file GeoTessGrid.h.

## ◆ getVertexIndex() [3/4]

int geotess::GeoTessGrid::getVertexIndex | ( | int | tessId,
|  | int | level,
|  | int | triangle,
|  | int | corner ) const
| inline

Get the index of the vertex that occupies the specified position in the hierarchy.

Parameters

  tessId | tessellation index
  level | index of a level relative to the first level of the specified tessellation
  triangle | the i'th triangle in the specified tessellation/level
  corner | the i'th corner of the specified tessellation/level/triangle

Returns
  index of a vertex

Definition at line 693 of file GeoTessGrid.h.

## ◆ getVertexIndex() [4/4]

int geotess::GeoTessGrid::getVertexIndex | ( | int | triangle,
|  | int | corner ) const
| inline

Get the index of the vertex that occupies the specified position in the hierarchy.

Parameters

  triangle | the i'th triangle in the grid
  corner | the i'th corner of the specified triangle

Returns
  index of a vertex

Definition at line 675 of file GeoTessGrid.h.

## ◆ getVertexIndices()

const set< int > & geotess::GeoTessGrid::getVertexIndices | ( | const int & | tessId,
|  | const int & | level )
| inline

Retrieve a set containing the indices of all the vertices that are connected together by triangles on the specified level. The index of the level is relative to the first level of the specified tessellation.

Lazy evaluation is used to generate and store these sets.

Parameters

  tessId | index of the tessellation.
  level | index of the level relative to the first level of the specified tessellation.

Returns
  a set containing the indices of all the vertices that are connected together by triangles on the specified level.

Definition at line 799 of file GeoTessGrid.h.

## ◆ getVertexIndicesTopLevel()

const set< int > & geotess::GeoTessGrid::getVertexIndicesTopLevel | ( | const int & | tessId | ) |
| inline

Retrieve a set containing the indices of all the vertices that are connected together by triangles on the top level of the specified tessellation.

Lazy evaluation is used to generate and store these sets.

Parameters

  tessId | index of the tessellation.

Returns
  a set containing the indices of all the vertices that are connected together by triangles on the top level of the specified tessellation.

Definition at line 813 of file GeoTessGrid.h.

## ◆ getVertexNeighbors() [1/2]

void geotess::GeoTessGrid::getVertexNeighbors | ( | const int & | tessId,
|  | const int & | level,
|  | const int & | vertex,
|  | const int & | order,
|  | set< int > & | nbrs )

Retrieve a list of the indexes of all the vertexes that are within a neighborhood of the specified vertex. The neighborhood is defined by the argument "order". If order is 1, then all the vertices that are connected by a single edge to vertex are included. If order is 2, then take the order 1 neighborhood and add all the vertices that are connected to any vertex in the order-1 neighborhood by a single edge. Keep doing that to as high order as desired. Only triangles in the specified tessellation and level are considered.

Supplied set nbrs is cleared at the beginning of this method and it will not contain starting vertex upon return.

Parameters

  tessId | tessellation index
  level | index of a level relative to the first level of the specified tessellation
  vertex |
  order |
  nbrs | list of vertex indices

## ◆ getVertexNeighbors() [2/2]

void geotess::GeoTessGrid::getVertexNeighbors | ( | const int & | tessId,
|  | const int & | level,
|  | const int & | vertex,
|  | set< int > & | nbrs )
| inline

Retrieve a list of the indexes of all the vertexes that are connected to the specified vertex by a single edge, considering only triangles in the specified tessellation and level.

Equivalent to calling this function with extra parameter "order" = 1.

Parameters

  tessId | tessellation index
  level | index of a level relative to the first level of the specified tessellation
  vertex | index of a vertex
  nbrs | indexes of vertices

Definition at line 1294 of file GeoTessGrid.h.

## ◆ getVertexNeighborsOrdered()

void geotess::GeoTessGrid::getVertexNeighborsOrdered | ( | const int & | tessId,
|  | const int & | level,
|  | const int & | vertex,
|  | vector< int > & | v )

GeoTessGrid maintains a list of the triangles that each vertex is a member of. there is a separate list for every tessellation level in the grid. Lazy evaluation is used to build this list.

This method clears the list for all tessellation levels. Retrieve a list of the indexes of all the vertexes that are connected to the specified vertex by a single edge, considering only triangles in the specified tessellation and level. The vertices will be arranged in clockwise order when viewed from outside the unit sphere.

Parameters

  tessId | the tessellation index
  level | index of a level relative to the first level of the specified tessellation
  vertex | index of central vertex
  v | vector of vertex indexes

## ◆ getVertexTriangles() [1/3]

const vector< vector< int > > & geotess::GeoTessGrid::getVertexTriangles | ( | const int & | level | ) | const
| inline

Retrieve a list of the triangles a particular vertex is a member of, considering only triangles in the specified tessellation/level.

Parameters

  level | index of a level relative to all levels in the grid.

Returns
  vector of vertex indexes

Definition at line 1231 of file GeoTessGrid.h.

## ◆ getVertexTriangles() [2/3]

const vector< int > & geotess::GeoTessGrid::getVertexTriangles | ( | const int & | tessId,
|  | const int & | level,
|  | const int & | vertex ) const
| inline

Retrieve a list of the triangles a particular vertex is a member of, considering only triangles in the specified tessellation/level.

Lazy evaluation is used here. The list of indexes is initially empty and is computed and stored on demand. Once computed the indexes remain in memory for the next time they might be called.

Parameters

  tessId | the tessellation index
  level | index of a level relative to the first level of the specified tessellation
  vertex | the index of the vertex

Returns
  vector of vertex indexes

Definition at line 1245 of file GeoTessGrid.h.

## ◆ getVertexTriangles() [3/3]

const vector< int > & geotess::GeoTessGrid::getVertexTriangles | ( | int | tessId,
|  | int | vertex ) const
| inline

Retrieve a list of the triangles a particular vertex is a member of, considering only triangles in the top level of the specified tessellation.

Lazy evaluation is used here. The list of indexes is initially empty and is computed and stored on demand. Once computed the indexes remain in memory for the next time they might be called.

Parameters

  tessId | tessellation index
  vertex |

Returns
  list of triangle indeces

Definition at line 1261 of file GeoTessGrid.h.

## ◆ getVertices() [1/2]

double const *const * geotess::GeoTessGrid::getVertices | ( |  | ) | const
| inline

Retrieve a reference to all of the vertices. Vertices consists of an nVertices x 3 array of doubles. The double[3] array associated with each vertex is the 3 component unit vector that defines the position of the vertex.

Users should not modify the contents of the array.

Returns
  nVertices x 3 array of unit vectors.

Definition at line 761 of file GeoTessGrid.h.

## ◆ getVertices() [2/2]

void geotess::GeoTessGrid::getVertices | ( | const int & | tessellation,
|  | const int & | level,
|  | set< const double * > & | vectors )

Return a set containing the unit vectors of all the vertices that are connected together by triangles on the specified tessellation and level.

Parameters

  tessellation |
  level | the level relative to the first level of the specified tessellation
  vectors | (output) a set containing the unit vectors of all the vertices that are connected together by triangles on the specified tessellation and level.

## ◆ getVerticesTopLevel()

void geotess::GeoTessGrid::getVerticesTopLevel | ( | const int & | tessellation,
|  | set< const double * > & | vectors )
| inline

Retrieve a set containing the unit vectors of all the vertices that are connected together by triangles on the top level of the specified tessellation.

Parameters

  tessellation |
  vectors | (output) a set containing the unit vectors of all the vertices that are connected together by triangles on the top level of the specified tessellation.

Definition at line 771 of file GeoTessGrid.h.

## ◆ initialize()

void geotess::GeoTessGrid::initialize | ( |  | ) |
| protected

Identify the neighbors and descendants of each triangle. This method is called during construction of a GeoTessGrid object (i.e., when it is loaded from a file). Applications should not call this method.

## ◆ isGeoTessGrid()

bool geotess::GeoTessGrid::isGeoTessGrid | ( | const string & | inputFile | ) |
| static

Test a file to see if it is a GeoTessGrid file.

Parameters

  inputFile |

Returns
  true if inputFile is a GeoTessGrid file.

## ◆ loadGrid()

GeoTessGrid * geotess::GeoTessGrid::loadGrid | ( | const string & | inputFile | ) |

Load GeoTessGrid object from a File.

Parameters

  inputFile | name of file from which to load grid.

Returns
  pointer to a Grid object

## ◆ operator!=()

bool geotess::GeoTessGrid::operator!= | ( | const GeoTessGrid & | g | ) | const
| inline

Return true if the input Grid object (g) gridID is not equal to this Grid objects gridID.

Parameters

  g | the other grid object to which this grid is to be compared.

Returns
  true if this grid and other grid have different gridIDs.

Definition at line 551 of file GeoTessGrid.h.

## ◆ operator=()

GeoTessGrid & geotess::GeoTessGrid::operator= | ( | const GeoTessGrid & | other | ) |

Equal operator. Makes a deep copy.

Parameters

  other | the other GeoTessGrid whose values are to be duplicated here.

Returns
  reference to a deep copy of this grid

## ◆ operator==()

bool geotess::GeoTessGrid::operator== | ( | const GeoTessGrid & | g | ) | const
| inline

Return true if the input Grid object (g) gridID equals this Grid objects gridID.

Parameters

  g | the other grid object to which this grid is to be compared.

Returns
  true if this grid and other grid have same gridIDs.

Definition at line 543 of file GeoTessGrid.h.

## ◆ setGridGenerationDate()

void geotess::GeoTessGrid::setGridGenerationDate | ( | const string & | gridDate | ) |
| inline

Set the date when this grid was generated. This is not necessarily the same as the date when the file was copied or translated.

Parameters

  gridDate |

Definition at line 591 of file GeoTessGrid.h.

## ◆ setGridInputFile()

void geotess::GeoTessGrid::setGridInputFile | ( | const string & | gridFile | ) |
| inline

Set the grid input file name.

Parameters

  gridFile | name of grid file.

Definition at line 605 of file GeoTessGrid.h.

## ◆ setGridSoftwareVersion()

void geotess::GeoTessGrid::setGridSoftwareVersion | ( | const string & | swVersion | ) |
| inline

Set the name and version number of the software that generated the contents of this grid.

Parameters

  swVersion | the name and version number of the software that generated the contents of this grid.

Definition at line 575 of file GeoTessGrid.h.

## ◆ testGrid()

void geotess::GeoTessGrid::testGrid | ( |  | ) |

Tests the integrity of the grid. Visits every triangle T, and (1) checks to ensure that every neighbor of T includes T in its list of neighbors, and (2) checks that every neighbor of T shares exactly two nodes with T.

Exceptions

  GeoTessException | if anything is amiss.

## ◆ toString()

string geotess::GeoTessGrid::toString | ( |  | ) |

Returns
  summary information about this GeoTessGrid object.

## Member Data Documentation

## ◆ levels

int** geotess::GeoTessGrid::levels
| protected

An n x 2 array where n is the number of tessellation levels in all the tessellations that constitute this model. For each tessellation level, the first element of the int[2] specifies the index of the first triangle in the tess level and the second element specifies the index of the last triangle on the tess level + 1.

A level is a single-level tessellation of a unit sphere, which is to say that it is a set of triangles that completely spans the surface of a unit sphere without gaps or overlaps.

Definition at line 207 of file GeoTessGrid.h.

## ◆ nLevels

int geotess::GeoTessGrid::nLevels
| protected

Number of levels.

Definition at line 212 of file GeoTessGrid.h.

## ◆ nTessellations

int geotess::GeoTessGrid::nTessellations
| protected

Number of tessellations.

Definition at line 232 of file GeoTessGrid.h.

## ◆ nTriangles

int geotess::GeoTessGrid::nTriangles
| protected

Number of triangles.

Definition at line 194 of file GeoTessGrid.h.

## ◆ nVertices

int geotess::GeoTessGrid::nVertices
| protected

Number of vertices.

Definition at line 182 of file GeoTessGrid.h.

## ◆ tessellations

int** geotess::GeoTessGrid::tessellations
| protected

tessellations is a n x 2 int array where n is the number of tessellations in the topology of the model. Each element specifies [0] the index of the first level and [1] last level + 1 that make up the tessellation.

A tessellation is a multi-level tessellation of a unit sphere, which is to say that it is a hierarchical set of single-level tessellations (see 'levels' above).

To loop over the triangles of tessellation tessid, level levelid:
for (int i=getFirtTriangle(tessid, levelid); i < getLastTriangle(tessid, levelid); ++i)
{ // do something with triangles[i] }

Definition at line 227 of file GeoTessGrid.h.

## ◆ triangles

int** geotess::GeoTessGrid::triangles
| protected

An nTriangles x 3 array of integers. Each triangle is represented by the indexes of the 3 vertices that form the corners of the triangle, listed in clockwise order when viewed from outside the tessellation.

Definition at line 189 of file GeoTessGrid.h.

## ◆ vertices

double** geotess::GeoTessGrid::vertices
| protected

An nVertices x 3 array of tessellation vertices. Each vertex is represented by a 3-component unit vector with it's origin at the center of the earth. The x-component points toward lat,lon = 0, 0. The y-component points toward lat,lon = 0, 90. The z-component points toward north pole.

Definition at line 177 of file GeoTessGrid.h.

The documentation for this class was generated from the following file:

- rstt_v3.2.1/GeoTessCPP/include/GeoTessGrid.h