tlp::Rectangle< Obj > Struct Template Reference
[Basic]
#include <Rectangle.h>
Inherits tlp::Array< Vector< Obj, 2 >, 2 >.
Inheritance diagram for tlp::Rectangle< Obj >:
[legend]Collaboration diagram for tlp::Rectangle< Obj >:
[legend]List of all members.
Detailed Description
template<typename Obj>
struct tlp::Rectangle< Obj >
class for rectangle
Enables to both create and manipulate a 2D Axis Aligned Rectangle
Author : <a href="www.tulip-software.org>Tulip team
Public Member Functions
- Rectangle ()
- Rectangle (const Obj xmin, const Obj ymin, const Obj xmax, const Obj ymax)
- Rectangle (const tlp::BoundingBox &b)
- Rectangle (const Vector< Obj, 2 > &min, const Vector< Obj, 2 > &max)
- bool intersect (const Rectangle &r) const
- bool intersect (const Rectangle &r, Rectangle &intersection) const
- bool isValid () const
- bool isInside (const Vector< Obj, 2 > &p) const
- bool isInside (const Rectangle &r) const
- void translate (const tlp::Vector< Obj, 2 > &v)
- Obj width () const
- Obj height () const
- Obj surface () const
- Obj aspectRatio () const
- Vector< Obj, 2 > center () const
Constructor & Destructor Documentation
|
Create a new invalid rectangle |
template<typename Obj> |
tlp::Rectangle< Obj >::Rectangle |
( |
const Obj |
xmin, |
|
|
const Obj |
ymin, |
|
|
const Obj |
xmax, |
|
|
const Obj |
ymax |
|
) |
[inline] |
|
|
Create a new rectangle with (*this)[0] = min = (xmin, ymin); (*this)[1] = max = (xmax, ymax); Validity is tested in debug mode; |
|
Create a new Rectangle from a Bounding Box correct conversion from 3D -> 2D validity of the new Rectangle is tested in debug mode |
|
create a new Rectangle Validity is checked in debug mode |
Member Function Documentation
template<typename Obj> |
Obj tlp::Rectangle< Obj >::aspectRatio |
( |
|
) |
const [inline] |
|
|
Return the aspect ratio of the reactangle a value between [0..1] |
|
Return the aspect ratio of the reactangle a value between [0..1] |
template<typename Obj> |
Obj tlp::Rectangle< Obj >::height |
( |
|
) |
const [inline] |
|
|
Return the height of the rectangle The Rectangle must be valid (tested in debug) |
|
- Returns:
- the true if there is an intersection else false, the intersection parameter is used to stored the Rectangle pf intersection (if it exists).
|
|
- Returns:
- true if r intersect "this".
|
|
- Returns:
- true if r is inside or equal to the AARectangle Validity of Rectangles is tested in debug mode
|
template<typename Obj> |
bool tlp::Rectangle< Obj >::isInside |
( |
const Vector< Obj, 2 > & |
p |
) |
const [inline] |
|
|
Return true if point is stricly inside the AARectangle validity of the current rectangle is tested in debug mode |
template<typename Obj> |
bool tlp::Rectangle< Obj >::isValid |
( |
|
) |
const [inline] |
|
|
- Returns:
- true if the Rectangle is well define [0] min corner, [1] max corner.
|
template<typename Obj> |
Obj tlp::Rectangle< Obj >::surface |
( |
|
) |
const [inline] |
|
|
Return the surface of the rectangle The Rectangle must be valid (tested in debug) |
|
Translate "this" by vector v validity of the Rectangle is tested in debubg |
template<typename Obj> |
Obj tlp::Rectangle< Obj >::width |
( |
|
) |
const [inline] |
|
|
Return the width of the rectangle The Rectangle must be valid (tested in debug) |
|