ICAROUS
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
larcfm::BoundingRectangle Class Reference

#include <BoundingRectangle.h>

Public Member Functions

 BoundingRectangle ()
 
 BoundingRectangle (const std::vector< Vect2 > &vertices)
 
 BoundingRectangle (const BoundingRectangle &br)
 
void clear ()
 
void add (double x, double y)
 
void add (const Vect2 &v)
 
void add (const BoundingRectangle &br)
 
void add (const LatLonAlt &lla)
 
void add (const Position &p)
 
void add (const LatLonAlt &lla1, const LatLonAlt &lla2)
 
LatLonAlt fixLonWrap (const LatLonAlt &lla) const
 
Position fixLonWrap (const Position &p) const
 
bool contains (double x, double y) const
 
bool contains (const Vect2 &v) const
 
bool contains (const Vect3 &v) const
 
bool contains (const Position &p) const
 
bool contains (const LatLonAlt &lla) const
 
bool intersects (const BoundingRectangle &rect) const
 
bool intersects (const BoundingRectangle &rect, double buffer) const
 
double getMinX () const
 
double getMaxX () const
 
double getMinY () const
 
double getMaxY () const
 
double getMinLon () const
 
double getMaxLon () const
 
double getMinLat () const
 
double getMaxLat () const
 
Vect3 centerVect () const
 
Position centerPos () const
 
Position lowerLeft () const
 
Position upperRight () const
 
double getxCenter () const
 
bool isLatLon () const
 
std::string toString () const
 

Static Public Member Functions

static BoundingRectangle makePath (const std::vector< LatLonAlt > &vertices)
 
static BoundingRectangle makePoly (const std::vector< LatLonAlt > &vertices)
 
static BoundingRectangle makeUnconnected (const std::vector< LatLonAlt > &vertices)
 

Private Member Functions

double fix_lon (double lon) const
 

Private Attributes

double xMin
 
double xMax
 
double yMin
 
double yMax
 
double xCenter
 

Static Private Attributes

static const double nullAlt = -MAXDOUBLE
 

Detailed Description

A bounding rectangle for a (horizontal) 2-dimensional polygon. The bounding rectangle is the smallest rectangle that encloses a set of points. A point is contained in the rectangle if it lies within its boundary or on one of its edges. Thus, the bounding rectangle includes its boundary.

Special processing is conducted for LatLonAlt objects (including those embedded in Position objects. The special processing includes (1) altitude information is captured as a bound, but not used in the "contains" operation, and (2) proper handling when the longitude "wraps around" at -180/180. This second special processing means that a bounding rectangle for LatLonAlt is limited to 180 degrees (half the earth). Very erratic results will come from a bounding rectangle that has both LatLonAlt points and normal euclidean points.

Constructor & Destructor Documentation

◆ BoundingRectangle() [1/3]

larcfm::BoundingRectangle::BoundingRectangle ( )

Create a bounding rectangle with invalid values. When the first point is added, valid values are obtained.

◆ BoundingRectangle() [2/3]

larcfm::BoundingRectangle::BoundingRectangle ( const std::vector< Vect2 > &  vertices)
explicit

Create a bounding rectangle with the list of given points.

Parameters
verticeslist of vertices

Create a bounding rectangle with the list of given points.

◆ BoundingRectangle() [3/3]

larcfm::BoundingRectangle::BoundingRectangle ( const BoundingRectangle br)

Copy a bounding rectangle from an existing bounding rectangle

Parameters
brrectangle to copy

Copy a bounding rectangle from an existing bounding rectangle

Member Function Documentation

◆ add() [1/6]

void larcfm::BoundingRectangle::add ( const BoundingRectangle br)

Add another bounding rectangle to this bounding rectangle.

Parameters
brthe other bounding rectangle (this rest is not changed).

◆ add() [2/6]

void larcfm::BoundingRectangle::add ( const LatLonAlt lla2)

Add a point to this bounding rectangle. Note that when adding LatLonAlt points, great circle paths may fall outside the defined bounding rectangle! Therefore this should only be used by the GUI software! Use add(lla,lla) instead!

Parameters
llapoint

Add a point to this bounding rectangle. Note that when adding LatLonAlt points, great circle paths may fall outside the defined bounding rectangle!

Parameters
lla

◆ add() [3/6]

void larcfm::BoundingRectangle::add ( const LatLonAlt lla1,
const LatLonAlt lla2 
)

Add a great circle edge to this bounding rectangle. This is the safe way to add latlon points to the volume.

Parameters
lla1point 1
lla2point 2

Add a great circle edge to this bounding rectangle. This is the safe way to add latlon points to the volume.

Parameters
latx coordinate
lony coordinate

◆ add() [4/6]

void larcfm::BoundingRectangle::add ( const Position p)

Add a point to this bounding rectangle. Note that when adding LatLonAlt points, great circle paths may fall outside the defined bounding rectangle!

Parameters
ppoint

Add a point to this bounding rectangle. Note that when adding LatLonAlt points, great circle paths may fall outside the defined bounding rectangle!

Parameters
p

◆ add() [5/6]

void larcfm::BoundingRectangle::add ( const Vect2 v)

Add a point to this bounding rectangle.

Parameters
vvector

Add a point to this bounding rectangle.

Parameters
v

◆ add() [6/6]

void larcfm::BoundingRectangle::add ( double  x,
double  y 
)

Add a point to this bounding rectangle.

Parameters
xx coordinate
yy coordinate

Add a point to this bounding rectangle.

Parameters
x
y

◆ centerPos()

Position larcfm::BoundingRectangle::centerPos ( ) const

Return center Position for this BoundingRectangle. If any LatLonAlt values were input to the BoundingRectangle, this will be a normalized (within [-pi,+pi]) LatLonAlt position.

Returns
center

◆ centerVect()

Vect3 larcfm::BoundingRectangle::centerVect ( ) const

Return center vector value for this BoundingRectangle

Returns
center

◆ clear()

void larcfm::BoundingRectangle::clear ( )

Reset this bounding rectangle to a structure with invalid values. When the first point is added, valid values are obtained.

◆ contains() [1/4]

bool larcfm::BoundingRectangle::contains ( const LatLonAlt lla) const

Is this LatLonAlt in the contained area? (using only the latitude and longitude coordinates)

Parameters
llaa position
Returns
true if the point is contained

◆ contains() [2/4]

bool larcfm::BoundingRectangle::contains ( const Position p) const

Is this position in the contained area? (using only the X and Y coordinates)

Parameters
pa position
Returns
true if the point is contained

◆ contains() [3/4]

bool larcfm::BoundingRectangle::contains ( const Vect3 v) const

Is this Vect3 in the contained area? (using only the X and Y coordinates)

Parameters
vVect3
Returns
true if the point is contained

◆ contains() [4/4]

bool larcfm::BoundingRectangle::contains ( double  x,
double  y 
) const

Determines if the given point is within the bounding rectangle. A point on the edges of this rectangle is also within the rectangle.

Parameters
xthe x coordinate of the point in question
ythe y coordinate of the point in question
Returns
true if the point is within the bounding rectangle or on any of its edges.

◆ fixLonWrap() [1/2]

LatLonAlt larcfm::BoundingRectangle::fixLonWrap ( const LatLonAlt lla2) const

Return a LatLonAlt object that is consistent with this bounding rectangle. This LatLonAlt object may have a longitude greater than 180 degrees or less than -180 degrees.

Parameters
llaa LatLonAlt object
Returns
a LatLonAlt object with (possibly) non-standard longitude.

◆ fixLonWrap() [2/2]

Position larcfm::BoundingRectangle::fixLonWrap ( const Position p) const

Return a Position object that is consistent with this bounding rectangle. If this bounding rectangle contains latitude/longitude points, then the returned Position object may have a longitude greater than 180 degrees or less than -180 degrees.

Parameters
pa Position object
Returns
a LatLonAlt object with (possibly) non-standard longitude.

◆ getMaxX()

double larcfm::BoundingRectangle::getMaxX ( ) const
Returns
right bound

◆ getMaxY()

double larcfm::BoundingRectangle::getMaxY ( ) const
Returns
top bound

◆ getMinX()

double larcfm::BoundingRectangle::getMinX ( ) const
Returns
left bound

◆ getMinY()

double larcfm::BoundingRectangle::getMinY ( ) const
Returns
bottom bound

◆ intersects() [1/2]

bool larcfm::BoundingRectangle::intersects ( const BoundingRectangle rect) const

Does the given rectangle share any points with this rectangle? Only two dimensions are used.

Parameters
rectthe BoundingRectangle to be tested for intersection
Returns
true, if the supplied BoundingRectangle intersects this one

◆ intersects() [2/2]

bool larcfm::BoundingRectangle::intersects ( const BoundingRectangle rect,
double  buffer 
) const

Return true if any point in rect is within buffer of any point in this bounding rectangle. Only two dimensions are used

Parameters
rectanother rectangle
buffermaximum distance and still considered an overlap
Returns
true, if the supplied BoundingRectangle intersects this one

Return true if any point in rect is within buffer of any point in this bounding rectangle. Only two dimensions are used

Returns
true, if the supplied BoundingRectangle intersects this one

◆ isLatLon()

bool larcfm::BoundingRectangle::isLatLon ( ) const

Return true if a latlonalt position has been added to this rectangle.

Returns
true if lat/lon

◆ lowerLeft()

Position larcfm::BoundingRectangle::lowerLeft ( ) const

Return the lower left (southwest most) corner position of this rectangle

Returns
position

◆ makePath()

BoundingRectangle larcfm::BoundingRectangle::makePath ( const std::vector< LatLonAlt > &  vertices)
static

Create a bounding rectangle with the list of connected points that do not loop back on them selves, such as in a path.

Parameters
verticeslist of vertices
Returns
rectangle

Create a bounding rectangle with the list of given points.

Parameters
verticeslist of vertices

◆ makePoly()

BoundingRectangle larcfm::BoundingRectangle::makePoly ( const std::vector< LatLonAlt > &  vertices)
static

Create a bounding rectangle with the list of connected points that do loop back on themselves, so the last point is connected to the first point.

Parameters
verticeslist of vertices
Returns
rectangle

◆ makeUnconnected()

BoundingRectangle larcfm::BoundingRectangle::makeUnconnected ( const std::vector< LatLonAlt > &  vertices)
static

Create a bounding rectangle with the list of unconnected points.

Parameters
verticeslist of vertices
Returns
rectangle

Create a bounding rectangle with the list of unconnected points.

Parameters
verticeslist of vertices

◆ upperRight()

Position larcfm::BoundingRectangle::upperRight ( ) const

Return the upper right (northeast most) corner position of this rectangle

Returns
position

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