Shapes
GIS made easy, a lightweight header-only planar geometry library for Modern C++
Public Member Functions | Public Attributes | List of all members
simo::shapes::bounds_t Struct Reference

Represents an axis-aligned bounding box. More...

#include <bounds.hpp>

Public Member Functions

 bounds_t ()
 Creates a bounds object. More...
 
 bounds_t (double minx, double miny, double maxx, double maxy)
 Creates a bounds object from the given coordinates. More...
 
bounds_textend (double x, double y)
 Extends the bounds to contain the given point. More...
 
bounds_textend (const bounds_t &b)
 Extends the bounds to contain the given bounds. More...
 
std::tuple< double, double > center () const
 
std::tuple< double, double > bottom_left () const
 
std::tuple< double, double > top_right () const
 
std::tuple< double, double > top_left () const
 
std::tuple< double, double > bottom_right () const
 
bool contains (double x, double y) const
 
bool contains (const bounds_t &other)
 
bool intersects (const bounds_t &other)
 
bool overlaps (const bounds_t &other)
 

Public Attributes

double minx
 the minimum x-coordinate
 
double miny
 the minimum y-coordinate
 
double maxx
 the maximum x-coordinate
 
double maxy
 the maximum y-coordinate
 

Detailed Description

Represents an axis-aligned bounding box.

Since
0.0.1

Definition at line 18 of file bounds.hpp.

Constructor & Destructor Documentation

simo::shapes::bounds_t::bounds_t ( )
inline

Creates a bounds object.

Since
0.0.1

Definition at line 37 of file bounds.hpp.

simo::shapes::bounds_t::bounds_t ( double  minx,
double  miny,
double  maxx,
double  maxy 
)
inline

Creates a bounds object from the given coordinates.

Parameters
minxthe x-coordinate of the first corner
minythe y-coordinate of the first corner
maxxthe x-coordinate of the second corner
maxythe y-coordinate of the second corner
Since
0.0.1

Definition at line 55 of file bounds.hpp.

Member Function Documentation

std::tuple<double, double> simo::shapes::bounds_t::bottom_left ( ) const
inline
Returns
a (x, y) tuple with the bottom left bounds
Since
0.0.1

Definition at line 111 of file bounds.hpp.

std::tuple<double, double> simo::shapes::bounds_t::bottom_right ( ) const
inline
Returns
a (x, y) tuple with the bottom right bounds
Since
0.0.1

Definition at line 141 of file bounds.hpp.

std::tuple<double, double> simo::shapes::bounds_t::center ( ) const
inline
Returns
a (x, y) tuple with the center of the bounds
Since
0.0.1

Definition at line 101 of file bounds.hpp.

bool simo::shapes::bounds_t::contains ( double  x,
double  y 
) const
inline
Parameters
xthe x-coordinate of the point
ythe y-coordinate of the point
Returns
true if the bounds contains the given point, otherwise false
Since
0.0.1

Definition at line 153 of file bounds.hpp.

bool simo::shapes::bounds_t::contains ( const bounds_t other)
inline
Parameters
otherthe bounds
Returns
true if the bounds contain the given one, otherwise false
Since
0.0.1

Definition at line 164 of file bounds.hpp.

bounds_t& simo::shapes::bounds_t::extend ( double  x,
double  y 
)
inline

Extends the bounds to contain the given point.

Parameters
xthe x-coordinate of the point
ythe y-coordinate of the point
Returns
the bounds object
Since
0.0.1

Definition at line 69 of file bounds.hpp.

bounds_t& simo::shapes::bounds_t::extend ( const bounds_t b)
inline

Extends the bounds to contain the given bounds.

Parameters
xthe x-coordinate of the point
ythe y-coordinate of the point
Returns
the bounds object
Since
0.0.1

Definition at line 87 of file bounds.hpp.

bool simo::shapes::bounds_t::intersects ( const bounds_t other)
inline
Parameters
otherthe bounds
Returns
true if the bounds intersect the given one, otherwise false
Since
0.0.1

Definition at line 175 of file bounds.hpp.

bool simo::shapes::bounds_t::overlaps ( const bounds_t other)
inline
Parameters
otherthe bounds
Returns
true if the bounds overlaps the given one, otherwise false
Since
0.0.1

Definition at line 186 of file bounds.hpp.

std::tuple<double, double> simo::shapes::bounds_t::top_left ( ) const
inline
Returns
a (x, y) tuple with the top left bounds
Since
0.0.1

Definition at line 131 of file bounds.hpp.

std::tuple<double, double> simo::shapes::bounds_t::top_right ( ) const
inline
Returns
a (x, y) tuple with the top right bounds
Since
0.0.1

Definition at line 121 of file bounds.hpp.


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