GeoTessCPP  2.2
Software to facilitate storage and retrieval of 3D information about the Earth.
Public Member Functions | List of all members
geotess::GeoTessPolygon3D Class Reference

Extends Polygon by including information and constraints about the radial dimension. More...

#include <GeoTessPolygon3D.h>

Inheritance diagram for geotess::GeoTessPolygon3D:
geotess::GeoTessPolygon

Public Member Functions

 GeoTessPolygon3D ()
 
 GeoTessPolygon3D (vector< double * > points, GeoTessHorizon *h_bottom, GeoTessHorizon *h_top)
 Constructor that accepts a list of unit vectors that define the polygon. More...
 
 GeoTessPolygon3D (double *center, double radius, int nEdges, GeoTessHorizon *h_bottom, GeoTessHorizon *h_top)
 Constructor that builds a circular polygon of a specified horizontal radius centered on position center. More...
 
 GeoTessPolygon3D (string filename)
 Constructor that reads a Polygon from a file. More...
 
 ~GeoTessPolygon3D ()
 
virtual string class_name ()
 Returns the class name. More...
 
bool contains (const double *x, const double &radius, const int &layer, GeoTessProfile **profiles)
 Returns true if this Polygon3D contains the specified position. More...
 
bool contains (const double *x, const int &layer)
 Returns true if this Polygon3D contains the specified position. More...
 
bool contains (GeoTessPosition &position)
 Returns true if this Polygon3D contains the specified position. More...
 
bool containsAll (vector< double * > &points, vector< double > &radii, vector< int > &layers, vector< GeoTessProfile ** > &profiles)
 Returns true if this Polygon contains all of the supplied unit vectors. More...
 
bool containsAny (vector< double * > &points, vector< double > &radii, vector< int > &layers, vector< GeoTessProfile ** > &profiles)
 Returns true if this Polygon contains any of the supplied unit vectors. More...
 
GeoTessHorizongetBottom ()
 Retrieve a reference to the Horizon that defines the bottom of the active region. More...
 
GeoTessHorizongetTop ()
 Retrieve a reference to the Horizon that defines the top of the active region. More...
 
virtual void write (const string &outputFileName)
 
- Public Member Functions inherited from geotess::GeoTessPolygon
 GeoTessPolygon ()
 
 GeoTessPolygon (vector< double * > &points)
 Constructor that accepts a list of unit vectors that define the polygon. More...
 
 GeoTessPolygon (const double *center, double radius, int nEdges)
 Constructor that builds a circular polygon of a specified horizontal radius centered on position center. More...
 
 GeoTessPolygon (string filename)
 Constructor that reads a Polygon from a file. More...
 
virtual ~GeoTessPolygon ()
 
void addReference ()
 Add reference count;. More...
 
bool contains (const double *x)
 return true if point x is located inside the polygon More...
 
bool containsAll (const vector< double * > &positions)
 Returns true if this Polygon contains all of the supplied unit vectors. More...
 
bool containsAny (const vector< double * > &points)
 Returns true if this Polygon contains any of the supplied unit vectors. More...
 
double getArea ()
 Retrieve the area of this polygon. More...
 
double getAreaLarge ()
 Retrieve the area of this polygon. More...
 
double getAreaSmall ()
 Retrieve the area of this polygon. More...
 
const double * getPoint (int index)
 Retrieve a reference to one point on the polygon boundary. More...
 
void getPoints (vector< double * > &points, const bool &repeatFirstPoint)
 Retrieve a deep copy of the points on the polygon. More...
 
void getPoints (vector< double * > &points, const bool &repeatFirstPoint, const double &maxSpacing)
 Retrieve a deep copy of the points on the polygon. More...
 
int getRefCount ()
 
const double *const getReferencePoint ()
 Retrieve a reference to the referencePoint. More...
 
const void getReferencePoint (double *u)
 Retrieve a copy to the referencePoint. More...
 
bool getReferencePointIn ()
 Retrieve the value of referenceIn which indicates whether or not the referencePoint is inside or outside the Polygon. More...
 
void invert ()
 Invert the current polygon. More...
 
bool isNotReferenced ()
 Returns true if reference count is zero. More...
 
bool onBoundary (GeoTessGreatCircle &gcRef)
 Return true if evaluation point is very close to being on the boundary of the polygon. More...
 
bool onBoundary (const double *x)
 Return true if evaluation point is very close to being on the boundary of the polygon. More...
 
void removeReference ()
 Remove reference count;. More...
 
void setReferencePoint (const double *refPoint, const bool &inside)
 Specify the reference point for this polygon and whether or not the specified point is inside or outside the polygon. More...
 
void setReferencePoint (double lat, double lon, bool inside)
 Specify the reference point for this polygon and whether or not the specified point is inside or outside the polygon. More...
 
int size ()
 Returns the number of edges that define the polygon. More...
 
string str (const bool &repeatFirstPoint, const bool &latFirst, const double &minLongitude=-180)
 Returns a String containing all the points that define the polygon with one lon, lat pair per record. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from geotess::GeoTessPolygon
static double getTolerance ()
 Retrieve the tolerance value in radians used when comparing locations of two points. More...
 
- Public Attributes inherited from geotess::GeoTessPolygon
void * attachment
 Some unspecified information that applications can attach to this polygon. More...
 
- Protected Member Functions inherited from geotess::GeoTessPolygon
int edgeCrossings (GeoTessGreatCircle &gcRef)
 
void setup (vector< double * > &points)
 
- Protected Attributes inherited from geotess::GeoTessPolygon
vector< GeoTessGreatCircle * > edges
 A GreatCircle object for each edge of the polygon. More...
 
bool global
 If global is true this polygon encompasses the entire Earth and method contains() will always return the value of referenceIn. More...
 
bool lonFirst
 When reading/writing lat,lon data, should order be lat,lon or lon,lat. More...
 
int refCount
 Reference count. More...
 
bool referenceIn
 true if the referencePoint is inside the polygon. More...
 
double * referencePoint
 A point on the surface of the unit sphere that is used as a reference point. More...
 
- Static Protected Attributes inherited from geotess::GeoTessPolygon
static double TOLERANCE
 Tolerance value in radians used when comparing locations of two points. More...
 

Detailed Description

Extends Polygon by including information and constraints about the radial dimension.

An ordered list of points on the surface of a unit sphere that define a closed polygon. Polygons have the ability to test whether or not an arbitrary test point on the sphere is inside or outside the polygon.

Besides the set of points that define the boundary of the polgon, a Polygon object has a single private instance of a reference point which is known to be either 'inside' or 'outside' the polygon. By default, the reference point is computed from the supplied boundary points in the following manner:

This method will work fine provided that polygons are 'smaller' than approximately a hemisphere. It is possible to override this behavior. The first method is to call the invert() method which simply reverses the value of whether the reference point is 'inside' or 'outside' the polygon. There are also methods that allow applications to specify both the position of the reference point and whether it is 'inside' or 'outside' the polygon.

A test point that is located very close to a polygon boundary point is deemed to be 'inside' the polygon. This means that if two adjacent, non-overlapping polygons share a boundary point, a test point near that boundary point will be deemed to be 'inside' both polygons. In this context two points are 'very close' if they are separated by less than 1e-7 radians or 5.7e-6 degrees. For a sphere with the radius of the Earth (6371 km), this corresponds to a linear distance of about 60 cm.

Polygon implements reference counting. This means that when some other object obtains a reference to a Polygon object, it should increment the polygon's reference count. When it is done with the polygon it should decrement the polygon's reference count and delete the polygon if the reference count is equal to zero.

Author
sballar

Constructor & Destructor Documentation

geotess::GeoTessPolygon3D::~GeoTessPolygon3D ( )
geotess::GeoTessPolygon3D::GeoTessPolygon3D ( )
inline
geotess::GeoTessPolygon3D::GeoTessPolygon3D ( vector< double * >  points,
GeoTessHorizon h_bottom,
GeoTessHorizon h_top 
)
inline

Constructor that accepts a list of unit vectors that define the polygon.

The polygon will be closed, i.e., if the first point and last point are not coincident then an edge will be created between them.

Parameters
pointsarray of unit vectors specifying the positions that define the polygon.
h_bottomHorizon object that defines the bottom of the Polygon3D.
h_topHorizon object that defines the top of the Polygon3D.
geotess::GeoTessPolygon3D::GeoTessPolygon3D ( double *  center,
double  radius,
int  nEdges,
GeoTessHorizon h_bottom,
GeoTessHorizon h_top 
)
inline

Constructor that builds a circular polygon of a specified horizontal radius centered on position center.

Parameters
centerunit vector of the position that defines the center of the circular Polygon.
radiusangular radius of the polygon, in radians.
nEdgesnumber of edges that define the polygon
h_bottomHorizon object that defines the bottom of the Polygon3D.
h_topHorizon object that defines the top of the Polygon3D.
geotess::GeoTessPolygon3D::GeoTessPolygon3D ( string  filename)

Constructor that reads a Polygon from a file.

Parameters
filenamethe name of the file containing the polygon information.

throws a GeoTessException if specified file is a kml or kmz file. GeoTessExplorer can translate kml/kmz files to a compatible ascii format.

Member Function Documentation

virtual string geotess::GeoTessPolygon3D::class_name ( )
inlinevirtual

Returns the class name.

Reimplemented from geotess::GeoTessPolygon.

bool geotess::GeoTessPolygon3D::contains ( const double *  x,
const double &  radius,
const int &  layer,
GeoTessProfile **  profiles 
)
inline

Returns true if this Polygon3D contains the specified position.

Parameters
xthe unit vector of the position
radiusthe radius of the position in km
layerthe index of the layer in which the position resides
profilesa 1D array of profiles at the specified position. The number of elements must be equal to the number of layers in the model with the first layer being the deepest (closest to the center of the Earth) and the last layer being the shallowest (farthest from the center of the Earth).
Returns
true if this Polygon3D contains the specified position.
bool geotess::GeoTessPolygon3D::contains ( const double *  x,
const int &  layer 
)
inline

Returns true if this Polygon3D contains the specified position.

Parameters
xthe unit vector of the position
layerthe index of the layer in which the position resides
Returns
true if this Polygon3D contains the specified position.
bool geotess::GeoTessPolygon3D::contains ( GeoTessPosition position)

Returns true if this Polygon3D contains the specified position.

Parameters
position
Returns
true if this Polygon3D contains the specified position.
bool geotess::GeoTessPolygon3D::containsAll ( vector< double * > &  points,
vector< double > &  radii,
vector< int > &  layers,
vector< GeoTessProfile ** > &  profiles 
)
inline

Returns true if this Polygon contains all of the supplied unit vectors.

Parameters
pointsunit vectors of positions to be evaluated
radiithe radii of the positions to be evaluated. radii.size() and points.size() must be equal.
layersthe indexes of the layers in which the positions reside.
profilesthe array of Profiles at the current geographic position. profiles.size() must equal number of layers in the model.
Returns
true if this Polygon contains all of the supplied unit vectors
bool geotess::GeoTessPolygon3D::containsAny ( vector< double * > &  points,
vector< double > &  radii,
vector< int > &  layers,
vector< GeoTessProfile ** > &  profiles 
)
inline

Returns true if this Polygon contains any of the supplied unit vectors.

Parameters
pointsunit vectors of positions to be evaluated
radiithe radii of the positions to be evaluated. radii.size() and points.size() must be equal.
layersthe indexes of the layers in which the positions reside.
profilesthe array of Profiles at the current geographic position. profiles.size() must equal number of layers in the model.
Returns
true if this Polygon contains any of the supplied unit vectors
GeoTessHorizon* geotess::GeoTessPolygon3D::getBottom ( )
inline

Retrieve a reference to the Horizon that defines the bottom of the active region.

GeoTessHorizon* geotess::GeoTessPolygon3D::getTop ( )
inline

Retrieve a reference to the Horizon that defines the top of the active region.

virtual void geotess::GeoTessPolygon3D::write ( const string &  outputFileName)
virtual

Reimplemented from geotess::GeoTessPolygon.


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