SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
slip::Box2d< CoordType > Class Template Reference

This is a Box2d class, a specialized version of slip::Box<CoordType,DIM> with DIM = 2. More...

#include <Box2d.hpp>

Inheritance diagram for slip::Box2d< CoordType >:
Inheritance graph

Public Types

typedef Box2d< CoordType > self
 
typedef Box< CoordType, 2 > base
 
typedef CoordType value_type
 
typedef value_typeboxer
 
typedef const value_typeconst_boxer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef Point< CoordType, DIM > point_type
 
typedef DPoint< CoordType, DIM > dpoint_type
 

Public Member Functions

std::string name () const
 Returns the name of the class. More...
 
CoordType area () const
 compute the area of the Box2d. More...
 
CoordType width () const
 compute the width of the Box2d. More...
 
CoordType height () const
 compute the height of the Box2d. More...
 
bool contains (const point_type &p) const
 Returns true if the box contains the point p. More...
 
void translate (const dpoint_type &dp)
 Translate the window along the deplacement dp the dimensions of the window are conserved. More...
 
bool is_consistent () const
 verify if the window is consistent, that is to say if the first point p1 has the smaller coordinates than p2 More...
 
void swap (self &other)
 Swaps two Box. More...
 
Constructors & Destructors
 Box2d ()
 Constructs a Box2d. More...
 
 Box2d (const Point< CoordType, 2 > &p1, const Point< CoordType, 2 > &p2)
 Constructs a Box2d from a CoordType array. More...
 
 Box2d (const CoordType &x11, const CoordType &x12, const CoordType &x21, const CoordType &x22)
 Constructs a Box2d. More...
 
 Box2d (const CoordType &xc, const CoordType &yc, const CoordType &w)
 Constructs a square Box2d using a central point and a width. More...
 
 Box2d (const Point< CoordType, 2 > &pc, const CoordType &w)
 Constructs a square Box2d using a central point and a width. More...
 
 Box2d (const Point< CoordType, 2 > &pc, const CoordType &w1, const CoordType &w2)
 Constructs a square Box2d using a central point and two widths. More...
 
Element access operators
void upper_left (Point< CoordType, 2 >)
 Accessor/Mutator of the upper_left point (p1) of Box2d. More...
 
Point< CoordType, 2 > & upper_left ()
 Accessor/Mutator of the upper_left point (p1) of Box2d. More...
 
const Point< CoordType, 2 > & upper_left () const
 Accessor/Mutator of the upper_left point (p1) of Box2d. More...
 
void bottom_right (Point< CoordType, 2 >)
 Accessor/Mutator of the bottom_right point (p2) of Box2d. More...
 
Point< CoordType, 2 > & bottom_right ()
 Accessor/Mutator of the bottom_right point (p2) of Box2d. More...
 
const Point< CoordType, 2 > & bottom_right () const
 Accessor/Mutator of the bottom_right point (p2) of Box2d. More...
 
void set_coord (const CoordType &x11, const CoordType &x12, const CoordType &x21, const CoordType &x22)
 Mutator of the coordinates of the Box2d. More...
 
Comparison operators
bool operator== (const self &other) const
 compare two Box. More...
 
bool operator!= (const self &other) const
 compare two Box. More...
 

Protected Attributes

point_type p1_
 
point_type p2_
 

Friends

class boost::serialization::access
 

Detailed Description

template<typename CoordType>
class slip::Box2d< CoordType >

This is a Box2d class, a specialized version of slip::Box<CoordType,DIM> with DIM = 2.

Author
Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>
Julien Dombre <dombre_AT_sic.univ-poitiers.fr>
Version
0.0.3
Date
2014/03/15
Since
1.0.0
Description:
The box is defined by its upper-left and bottom-right points p1 and p2.
p1--------
| |
| |
| |
| |
---------p2
Parameters
CoordTypeType of the coordinates of the Box2d

Definition at line 116 of file Box2d.hpp.

Member Typedef Documentation

template<typename CoordType>
typedef Box<CoordType,2> slip::Box2d< CoordType >::base

Definition at line 120 of file Box2d.hpp.

typedef value_type* slip::Box< CoordType, DIM >::boxer
inherited

Definition at line 124 of file Box.hpp.

typedef const value_type* slip::Box< CoordType, DIM >::const_boxer
inherited

Definition at line 125 of file Box.hpp.

typedef const value_type& slip::Box< CoordType, DIM >::const_reference
inherited

Definition at line 127 of file Box.hpp.

typedef DPoint<CoordType,DIM> slip::Box< CoordType, DIM >::dpoint_type
inherited

Definition at line 129 of file Box.hpp.

typedef Point<CoordType,DIM> slip::Box< CoordType, DIM >::point_type
inherited

Definition at line 128 of file Box.hpp.

typedef value_type& slip::Box< CoordType, DIM >::reference
inherited

Definition at line 126 of file Box.hpp.

template<typename CoordType>
typedef Box2d<CoordType> slip::Box2d< CoordType >::self

Definition at line 119 of file Box2d.hpp.

typedef CoordType slip::Box< CoordType, DIM >::value_type
inherited

Definition at line 123 of file Box.hpp.

Constructor & Destructor Documentation

template<typename CoordType >
slip::Box2d< CoordType >::Box2d ( )
inline

Constructs a Box2d.

Remarks
call the default constructors of Point<CoordType,2>

Definition at line 278 of file Box2d.hpp.

template<typename CoordType>
slip::Box2d< CoordType >::Box2d ( const Point< CoordType, 2 > &  p1,
const Point< CoordType, 2 > &  p2 
)
inline

Constructs a Box2d from a CoordType array.

Parameters
p1first extremal point
p2second extremal point

Definition at line 284 of file Box2d.hpp.

template<typename CoordType>
slip::Box2d< CoordType >::Box2d ( const CoordType &  x11,
const CoordType &  x12,
const CoordType &  x21,
const CoordType &  x22 
)
inline

Constructs a Box2d.

Parameters
x11first coordinate of the minimal point p1
x12second coordinate of the minimal point p1
x21first coordinate of the maximal point p2
x22second coordinate of the maximal point p2

Definition at line 291 of file Box2d.hpp.

template<typename CoordType>
slip::Box2d< CoordType >::Box2d ( const CoordType &  xc,
const CoordType &  yc,
const CoordType &  w 
)
inline

Constructs a square Box2d using a central point and a width.

Parameters
xcfirst coordinate of the central point
ycsecond coordinate of the central point
wwidth of the box (real width and height=2*w+1)

Definition at line 300 of file Box2d.hpp.

template<typename CoordType>
slip::Box2d< CoordType >::Box2d ( const Point< CoordType, 2 > &  pc,
const CoordType &  w 
)
inline

Constructs a square Box2d using a central point and a width.

Parameters
pccentral point
wwidth of the box (real width and height=2*w+1)

Definition at line 308 of file Box2d.hpp.

template<typename CoordType>
slip::Box2d< CoordType >::Box2d ( const Point< CoordType, 2 > &  pc,
const CoordType &  w1,
const CoordType &  w2 
)
inline

Constructs a square Box2d using a central point and two widths.

Parameters
pccentral point
w1width of the first coordinate box (real width =2*w1+1)
w2width of the second coordinate box (real height =2*w2+1)

Definition at line 316 of file Box2d.hpp.

Member Function Documentation

template<typename CoordType >
CoordType slip::Box2d< CoordType >::area ( ) const
inline

compute the area of the Box2d.

Returns
the area

Definition at line 370 of file Box2d.hpp.

template<typename CoordType>
void slip::Box2d< CoordType >::bottom_right ( Point< CoordType, 2 >  p2)
inline

Accessor/Mutator of the bottom_right point (p2) of Box2d.

Returns
reference to the bottom_right Point2d of the Box2d

Definition at line 338 of file Box2d.hpp.

template<typename CoordType>
Point< CoordType, 2 > & slip::Box2d< CoordType >::bottom_right ( )
inline

Accessor/Mutator of the bottom_right point (p2) of Box2d.

Returns
reference to the bottom_right Point2d of the Box2d

Definition at line 342 of file Box2d.hpp.

template<typename CoordType>
const Point< CoordType, 2 > & slip::Box2d< CoordType >::bottom_right ( ) const
inline

Accessor/Mutator of the bottom_right point (p2) of Box2d.

Returns
reference to the bottom_right Point2d of the Box2d

Definition at line 346 of file Box2d.hpp.

bool slip::Box< CoordType, DIM >::contains ( const point_type p) const
inherited

Returns true if the box contains the point p.

Parameters
ppoint to analyse
Returns
template<typename CoordType >
CoordType slip::Box2d< CoordType >::height ( ) const
inline

compute the height of the Box2d.

Returns
the height

Definition at line 378 of file Box2d.hpp.

bool slip::Box< CoordType, DIM >::is_consistent ( ) const
inherited

verify if the window is consistent, that is to say if the first point p1 has the smaller coordinates than p2

Returns
true if the "p1 < p2"
template<typename T >
std::string slip::Box2d< T >::name ( ) const
inline

Returns the name of the class.

Definition at line 365 of file Box2d.hpp.

bool slip::Box< CoordType, DIM >::operator!= ( const self other) const
inherited

compare two Box.

Parameters
otherBox to compare
Returns
true if the two box don't have the same coordinates
bool slip::Box< CoordType, DIM >::operator== ( const self other) const
inherited

compare two Box.

Parameters
otherBox to compare
Returns
true if the two box have the same coordinates
template<typename CoordType>
void slip::Box2d< CoordType >::set_coord ( const CoordType &  x11,
const CoordType &  x12,
const CoordType &  x21,
const CoordType &  x22 
)
inline

Mutator of the coordinates of the Box2d.

Parameters
x11first coordinate of the minimal point p1
x12second coordinate of the minimal point p1
x21first coordinate of the maximal point p2
x22second coordinate of the maximal point p2
Returns

Definition at line 351 of file Box2d.hpp.

void slip::Box< CoordType, DIM >::swap ( self other)
inherited

Swaps two Box.

Parameters
otherBox to swap with
void slip::Box< CoordType, DIM >::translate ( const dpoint_type dp)
inherited

Translate the window along the deplacement dp the dimensions of the window are conserved.

Parameters
dpdeplacement of the window
Returns
template<typename CoordType>
void slip::Box2d< CoordType >::upper_left ( Point< CoordType, 2 >  p1)
inline

Accessor/Mutator of the upper_left point (p1) of Box2d.

Returns
reference to the upper_left Point2d of the Box2d

Definition at line 325 of file Box2d.hpp.

template<typename CoordType>
Point< CoordType, 2 > & slip::Box2d< CoordType >::upper_left ( )
inline

Accessor/Mutator of the upper_left point (p1) of Box2d.

Returns
reference to the upper_left Point2d of the Box2d

Definition at line 329 of file Box2d.hpp.

template<typename CoordType>
const Point< CoordType, 2 > & slip::Box2d< CoordType >::upper_left ( ) const
inline

Accessor/Mutator of the upper_left point (p1) of Box2d.

Returns
reference to the upper_left Point2d of the Box2d

Definition at line 333 of file Box2d.hpp.

template<typename CoordType >
CoordType slip::Box2d< CoordType >::width ( ) const
inline

compute the width of the Box2d.

Returns
the width

Definition at line 374 of file Box2d.hpp.

Friends And Related Function Documentation

template<typename CoordType>
friend class boost::serialization::access
friend

Definition at line 259 of file Box2d.hpp.

Member Data Documentation

point_type slip::Box< CoordType, DIM >::p1_
protectedinherited

First extremal coordinate of the box

Definition at line 257 of file Box.hpp.

point_type slip::Box< CoordType, DIM >::p2_
protectedinherited

Second extremal coordinate of the box

Definition at line 261 of file Box.hpp.


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