CVB++ 14.0
Rect< T, ENABLE > Class Template Referencefinal

Rectangle object. More...

#include <cvb/rect.hpp>

Public Member Functions

 Rect () noexcept
 Default rectangle in the integral type system. More...
 
 Rect (T left, T top, T right, T bottom) noexcept
 Constructor for a rectangle. More...
 
 Rect (Point2D< T > location, Size2D< T > size) noexcept
 Constructor for a rectangle. More...
 
Left () const noexcept
 Gets first column of the rectangle. More...
 
void SetLeft (T left) noexcept
 Sets first column of the rectangle. More...
 
Top () const noexcept
 Gets first row of the rectangle. More...
 
void SetTop (T top) noexcept
 Sets first row of the rectangle. More...
 
Right () const noexcept
 Gets rightmost column of the rectangle (still inside the rectangle). More...
 
void SetRight (T right) noexcept
 Sets rightmost column of the rectangle (still inside the rectangle). More...
 
Bottom () const noexcept
 Gets bottom row of the rectangle (still inside the rectangle). More...
 
void SetBottom (T bottom) noexcept
 Sets bottom row of the rectangle (still inside the rectangle). More...
 
Width () const noexcept
 Gets the width of the rectangle. More...
 
void SetWidth (T width) noexcept
 Sets the width of the rectangle. More...
 
Height () const noexcept
 Gets the height of the rectangle. More...
 
void SetHeight (T height) noexcept
 Sets the height of the rectangle. More...
 
Size2D< T > Size () const noexcept
 Gets the size of the rectangle. More...
 
void SetSize (Size2D< T > size) noexcept
 Gets the size of the rectangle. More...
 
Point2D< T > Location () const noexcept
 Gets the location of the top left corner of the rectangle. More...
 
void SetLocation (Point2D< T > location) noexcept
 Sets the location of the top left corner of the rectangle. More...
 
bool Contains (Point2D< T > point) const noexcept
 Checks if this rectangle contains a point. More...
 
CoordinateSystemType CoordinateSystem () const noexcept
 Indicates the coordinate system in which this object is being measured (when used as an area of interest). More...
 
bool operator== (const Rect< T > &rect) const noexcept
 Compares to another rectangle. More...
 
bool operator!= (const Rect< T > &rect) const noexcept
 Compares to another rectangle. More...
 

Detailed Description

template<class T, class ENABLE = void>
class Cvb::Rect< T, ENABLE >

Rectangle object.

Common Vision Blox always uses rectangles (or rectangular shaped areas of interest represented by integer parameters left, top, right and bottom) in such a way, that right and bottom are still part of the area to be investigated (i.e. Width = Right - Left + 1 and Height = Bottom - Top + 1).

Examples
ShapeFinder2/QtShapeFinder2.

Constructor & Destructor Documentation

◆ Rect() [1/3]

Rect ( )
inlinenoexcept

Default rectangle in the integral type system.

Exceptions
Doesnot throw any exception.

The top-left corner will be at (0, 0) and the other corner point will be at (-1, -1).

◆ Rect() [2/3]

Rect ( left,
top,
right,
bottom 
)
inlinenoexcept

Constructor for a rectangle.

Parameters
[in]leftLeftmost column of the rectangle.
[in]topTopmost column of the rectangle.
[in]rightRightmost column of the rectangle.
[in]bottomBottom columns of the rectangle.
Exceptions
Doesnot throw any exception.

◆ Rect() [3/3]

Rect ( Point2D< T >  location,
Size2D< T >  size 
)
inlinenoexcept

Constructor for a rectangle.

Parameters
[in]locationLocation of the rectangle.
[in]sizeSize of the rectangle.
Exceptions
Doesnot throw any exception.

Member Function Documentation

◆ Bottom()

T Bottom ( ) const
inlinenoexcept

Gets bottom row of the rectangle (still inside the rectangle).

Returns
The last row.
Exceptions
Doesnot throw any exception.
Examples
ShapeFinder2/QtShapeFinder2.

◆ Contains()

bool Contains ( Point2D< T >  point) const
inlinenoexcept

Checks if this rectangle contains a point.

Parameters
[in]pointPoint to check.
Returns
True if the point is inside this rect, false otherwise.
Exceptions
Doesnot throw any exception.

◆ CoordinateSystem()

CoordinateSystemType CoordinateSystem ( ) const
inlinenoexcept

Indicates the coordinate system in which this object is being measured (when used as an area of interest).

Returns
The coordinate system type.
Exceptions
Doesnot throw any exception.

◆ Height()

T Height ( ) const
inlinenoexcept

Gets the height of the rectangle.

Returns
The height.
Exceptions
Doesnot throw any exception.

◆ Left()

T Left ( ) const
inlinenoexcept

Gets first column of the rectangle.

Returns
First column.
Exceptions
Doesnot throw any exception.
Examples
ShapeFinder2/QtShapeFinder2.

◆ Location()

Point2D< T > Location ( ) const
inlinenoexcept

Gets the location of the top left corner of the rectangle.

Returns
The location.
Exceptions
Doesnot throw any exception.

◆ operator!=()

bool operator!= ( const Rect< T > &  rect) const
inlinenoexcept

Compares to another rectangle.

Parameters
[in]rectOther rectangle.
Returns
True if not equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator==()

bool operator== ( const Rect< T > &  rect) const
inlinenoexcept

Compares to another rectangle.

Parameters
[in]rectOther rectangle.
Returns
True if equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ Right()

T Right ( ) const
inlinenoexcept

Gets rightmost column of the rectangle (still inside the rectangle).

Returns
int Rightmost column.
Exceptions
Doesnot throw any exception.
Examples
ShapeFinder2/QtShapeFinder2.

◆ SetBottom()

void SetBottom ( bottom)
inlinenoexcept

Sets bottom row of the rectangle (still inside the rectangle).

Parameters
[in]bottomThe last row.
Exceptions
Doesnot throw any exception.

◆ SetHeight()

void SetHeight ( height)
inlinenoexcept

Sets the height of the rectangle.

Parameters
[in]heightThe height.
Exceptions
Doesnot throw any exception.

◆ SetLeft()

void SetLeft ( left)
inlinenoexcept

Sets first column of the rectangle.

Parameters
[in]leftFirst column.
Exceptions
Doesnot throw any exception.

◆ SetLocation()

void SetLocation ( Point2D< T >  location)
inlinenoexcept

Sets the location of the top left corner of the rectangle.

Parameters
[in]locationThe location.
Exceptions
Doesnot throw any exception.

◆ SetRight()

void SetRight ( right)
inlinenoexcept

Sets rightmost column of the rectangle (still inside the rectangle).

Parameters
[in]rightRightmost column.
Exceptions
Doesnot throw any exception.

◆ SetSize()

void SetSize ( Size2D< T >  size)
inlinenoexcept

Gets the size of the rectangle.

Parameters
[in]sizeThe size.
Exceptions
Doesnot throw any exception.

◆ SetTop()

void SetTop ( top)
inlinenoexcept

Sets first row of the rectangle.

Parameters
[in]topFirst row.
Exceptions
Doesnot throw any exception.

◆ SetWidth()

void SetWidth ( width)
inlinenoexcept

Sets the width of the rectangle.

Parameters
[in]widthThe width.
Exceptions
Doesnot throw any exception.

◆ Size()

Size2D< T > Size ( ) const
inlinenoexcept

Gets the size of the rectangle.

Returns
The size.
Exceptions
Doesnot throw any exception.

◆ Top()

T Top ( ) const
inlinenoexcept

Gets first row of the rectangle.

Returns
int First row.
Exceptions
Doesnot throw any exception.
Examples
ShapeFinder2/QtShapeFinder2.

◆ Width()

T Width ( ) const
inlinenoexcept

Gets the width of the rectangle.

Returns
The width.
Exceptions
Doesnot throw any exception.