ICAROUS
|
#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 |
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.
larcfm::BoundingRectangle::BoundingRectangle | ( | ) |
Create a bounding rectangle with invalid values. When the first point is added, valid values are obtained.
|
explicit |
Create a bounding rectangle with the list of given points.
vertices | list of vertices |
Create a bounding rectangle with the list of given points.
larcfm::BoundingRectangle::BoundingRectangle | ( | const BoundingRectangle & | br | ) |
Copy a bounding rectangle from an existing bounding rectangle
br | rectangle to copy |
Copy a bounding rectangle from an existing bounding rectangle
void larcfm::BoundingRectangle::add | ( | const BoundingRectangle & | br | ) |
Add another bounding rectangle to this bounding rectangle.
br | the other bounding rectangle (this rest is not changed). |
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!
lla | point |
Add a point to this bounding rectangle. Note that when adding LatLonAlt points, great circle paths may fall outside the defined bounding rectangle!
lla |
Add a great circle edge to this bounding rectangle. This is the safe way to add latlon points to the volume.
lla1 | point 1 |
lla2 | point 2 |
Add a great circle edge to this bounding rectangle. This is the safe way to add latlon points to the volume.
lat | x coordinate |
lon | y coordinate |
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!
p | point |
Add a point to this bounding rectangle. Note that when adding LatLonAlt points, great circle paths may fall outside the defined bounding rectangle!
p |
void larcfm::BoundingRectangle::add | ( | const Vect2 & | v | ) |
Add a point to this bounding rectangle.
v | vector |
Add a point to this bounding rectangle.
v |
void larcfm::BoundingRectangle::add | ( | double | x, |
double | y | ||
) |
Add a point to this bounding rectangle.
x | x coordinate |
y | y coordinate |
Add a point to this bounding rectangle.
x | |
y |
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.
Vect3 larcfm::BoundingRectangle::centerVect | ( | ) | const |
Return center vector value for this BoundingRectangle
void larcfm::BoundingRectangle::clear | ( | ) |
Reset this bounding rectangle to a structure with invalid values. When the first point is added, valid values are obtained.
bool larcfm::BoundingRectangle::contains | ( | const LatLonAlt & | lla | ) | const |
Is this LatLonAlt in the contained area? (using only the latitude and longitude coordinates)
lla | a position |
bool larcfm::BoundingRectangle::contains | ( | const Position & | p | ) | const |
Is this position in the contained area? (using only the X and Y coordinates)
p | a position |
bool larcfm::BoundingRectangle::contains | ( | const Vect3 & | v | ) | const |
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.
x | the x coordinate of the point in question |
y | the y coordinate of the point in question |
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.
p | a Position object |
double larcfm::BoundingRectangle::getMaxX | ( | ) | const |
double larcfm::BoundingRectangle::getMaxY | ( | ) | const |
double larcfm::BoundingRectangle::getMinX | ( | ) | const |
double larcfm::BoundingRectangle::getMinY | ( | ) | const |
bool larcfm::BoundingRectangle::intersects | ( | const BoundingRectangle & | rect | ) | const |
Does the given rectangle share any points with this rectangle? Only two dimensions are used.
rect | the BoundingRectangle to be tested for intersection |
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
rect | another rectangle |
buffer | maximum distance and still considered an overlap |
Return true if any point in rect is within buffer of any point in this bounding rectangle. Only two dimensions are used
bool larcfm::BoundingRectangle::isLatLon | ( | ) | const |
Return true if a latlonalt position has been added to this rectangle.
Position larcfm::BoundingRectangle::lowerLeft | ( | ) | const |
Return the lower left (southwest most) corner position of this rectangle
|
static |
Create a bounding rectangle with the list of connected points that do not loop back on them selves, such as in a path.
vertices | list of vertices |
Create a bounding rectangle with the list of given points.
vertices | list of 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.
vertices | list of vertices |
|
static |
Create a bounding rectangle with the list of unconnected points.
vertices | list of vertices |
Create a bounding rectangle with the list of unconnected points.
vertices | list of vertices |
Position larcfm::BoundingRectangle::upperRight | ( | ) | const |
Return the upper right (northeast most) corner position of this rectangle