Easy3D 2.6.1
Loading...
Searching...
No Matches
GenericRect< FT > Class Template Reference

The GenericRect class defines a rectangle in the 2D space, where the origin of the coordinate system is located in the top-left corner of the screen. More...

#include <easy3d/core/rect.h>

Public Member Functions

 GenericRect (const Vec< 2, FT > &p, const Vec< 2, FT > &q)
 Constructs a rectangle from two points p and q.
 
 GenericRect (FT xmin, FT xmax, FT ymin, FT ymax)
 Constructs a rectangle from its min coordinates (xmin and ymin) and max coordinates (xmax and ymax).
 
FT & x_min ()
 Returns the minimum x-coordinate.
 
FT & y_min ()
 Returns the minimum y-coordinate.
 
FT & x_max ()
 Returns the maximum x-coordinate.
 
FT & y_max ()
 Returns the maximum y-coordinate.
 
FT x_min () const
 Returns the minimum x-coordinate (const version).
 
FT y_min () const
 Returns the minimum y-coordinate (const version).
 
FT x_max () const
 Returns the maximum x-coordinate (const version).
 
FT y_max () const
 Returns the maximum y-coordinate (const version).
 
FT & x ()
 Returns the minimum x-coordinate (alias for x_min).
 
FT & y ()
 Returns the minimum y-coordinate (alias for y_min).
 
FT x () const
 Returns the minimum x-coordinate (alias for x_min) (const version).
 
FT y () const
 Returns the minimum y-coordinate (alias for y_min) (const version).
 
FT width () const
 Returns the width of the rectangle.
 
FT height () const
 Returns the height of the rectangle.
 
FT & left ()
 Returns the left coordinate (alias for x_min).
 
FT & top ()
 Returns the top coordinate (alias for y_min).
 
FT & right ()
 Returns the right coordinate (alias for x_max).
 
FT & bottom ()
 Returns the bottom coordinate (alias for y_max).
 
FT left () const
 Returns the left coordinate (alias for x_min) (const version).
 
FT top () const
 Returns the top coordinate (alias for y_min) (const version).
 
FT right () const
 Returns the right coordinate (alias for x_max) (const version).
 
FT bottom () const
 Returns the bottom coordinate (alias for y_max) (const version).
 
Vec< 2, FT > top_left () const
 Returns the position of the rectangle's top-left corner.
 
Vec< 2, FT > bottom_right () const
 Returns the position of the rectangle's bottom-right corner.
 
Vec< 2, FT > top_right () const
 Returns the position of the rectangle's top-right corner.
 
Vec< 2, FT > bottom_left () const
 Returns the position of the rectangle's bottom-left corner.
 
Vec< 2, FT > min_point () const
 Returns the minimum point of the rectangle.
 
Vec< 2, FT > max_point () const
 Returns the maximum point of the rectangle.
 
Vec< 2, FT > center () const
 Returns the center point of the rectangle.
 

Detailed Description

template<typename FT>
class easy3d::GenericRect< FT >

The GenericRect class defines a rectangle in the 2D space, where the origin of the coordinate system is located in the top-left corner of the screen.

A rectangle is normally expressed as a top-left corner and a size (width and height).

Template Parameters
FTThe scalar type for rectangle coordinates.

Constructor & Destructor Documentation

◆ GenericRect() [1/2]

template<typename FT>
GenericRect ( const Vec< 2, FT > & p,
const Vec< 2, FT > & q )
inline

Constructs a rectangle from two points p and q.

Parameters
pThe first point.
qThe second point.

◆ GenericRect() [2/2]

template<typename FT>
GenericRect ( FT xmin,
FT xmax,
FT ymin,
FT ymax )
inline

Constructs a rectangle from its min coordinates (xmin and ymin) and max coordinates (xmax and ymax).

Parameters
xminThe minimum x-coordinate.
xmaxThe maximum x-coordinate.
yminThe minimum y-coordinate.
ymaxThe maximum y-coordinate.

Member Function Documentation

◆ bottom() [1/2]

template<typename FT>
FT & bottom ( )
inline

Returns the bottom coordinate (alias for y_max).

Returns
The bottom coordinate.

◆ bottom() [2/2]

template<typename FT>
FT bottom ( ) const
inline

Returns the bottom coordinate (alias for y_max) (const version).

Returns
The bottom coordinate.

◆ bottom_left()

template<typename FT>
Vec< 2, FT > bottom_left ( ) const
inline

Returns the position of the rectangle's bottom-left corner.

Returns
The position of the bottom-left corner.

◆ bottom_right()

template<typename FT>
Vec< 2, FT > bottom_right ( ) const
inline

Returns the position of the rectangle's bottom-right corner.

Returns
The position of the bottom-right corner.

◆ center()

template<typename FT>
Vec< 2, FT > center ( ) const
inline

Returns the center point of the rectangle.

Returns
The center point.

◆ height()

template<typename FT>
FT height ( ) const
inline

Returns the height of the rectangle.

Returns
The height of the rectangle.

◆ left() [1/2]

template<typename FT>
FT & left ( )
inline

Returns the left coordinate (alias for x_min).

Returns
The left coordinate.

◆ left() [2/2]

template<typename FT>
FT left ( ) const
inline

Returns the left coordinate (alias for x_min) (const version).

Returns
The left coordinate.

◆ max_point()

template<typename FT>
Vec< 2, FT > max_point ( ) const
inline

Returns the maximum point of the rectangle.

Returns
The maximum point.

◆ min_point()

template<typename FT>
Vec< 2, FT > min_point ( ) const
inline

Returns the minimum point of the rectangle.

Returns
The minimum point.

◆ right() [1/2]

template<typename FT>
FT & right ( )
inline

Returns the right coordinate (alias for x_max).

Returns
The right coordinate.

◆ right() [2/2]

template<typename FT>
FT right ( ) const
inline

Returns the right coordinate (alias for x_max) (const version).

Returns
The right coordinate.

◆ top() [1/2]

template<typename FT>
FT & top ( )
inline

Returns the top coordinate (alias for y_min).

Returns
The top coordinate.

◆ top() [2/2]

template<typename FT>
FT top ( ) const
inline

Returns the top coordinate (alias for y_min) (const version).

Returns
The top coordinate.

◆ top_left()

template<typename FT>
Vec< 2, FT > top_left ( ) const
inline

Returns the position of the rectangle's top-left corner.

Returns
The position of the top-left corner.

◆ top_right()

template<typename FT>
Vec< 2, FT > top_right ( ) const
inline

Returns the position of the rectangle's top-right corner.

Returns
The position of the top-right corner.

◆ width()

template<typename FT>
FT width ( ) const
inline

Returns the width of the rectangle.

Returns
The width of the rectangle.

◆ x() [1/2]

template<typename FT>
FT & x ( )
inline

Returns the minimum x-coordinate (alias for x_min).

Returns
The minimum x-coordinate.

◆ x() [2/2]

template<typename FT>
FT x ( ) const
inline

Returns the minimum x-coordinate (alias for x_min) (const version).

Returns
The minimum x-coordinate.

◆ x_max() [1/2]

template<typename FT>
FT & x_max ( )
inline

Returns the maximum x-coordinate.

Returns
The maximum x-coordinate.

◆ x_max() [2/2]

template<typename FT>
FT x_max ( ) const
inline

Returns the maximum x-coordinate (const version).

Returns
The maximum x-coordinate.

◆ x_min() [1/2]

template<typename FT>
FT & x_min ( )
inline

Returns the minimum x-coordinate.

Returns
The minimum x-coordinate.

◆ x_min() [2/2]

template<typename FT>
FT x_min ( ) const
inline

Returns the minimum x-coordinate (const version).

Returns
The minimum x-coordinate.

◆ y() [1/2]

template<typename FT>
FT & y ( )
inline

Returns the minimum y-coordinate (alias for y_min).

Returns
The minimum y-coordinate.

◆ y() [2/2]

template<typename FT>
FT y ( ) const
inline

Returns the minimum y-coordinate (alias for y_min) (const version).

Returns
The minimum y-coordinate.

◆ y_max() [1/2]

template<typename FT>
FT & y_max ( )
inline

Returns the maximum y-coordinate.

Returns
The maximum y-coordinate.

◆ y_max() [2/2]

template<typename FT>
FT y_max ( ) const
inline

Returns the maximum y-coordinate (const version).

Returns
The maximum y-coordinate.

◆ y_min() [1/2]

template<typename FT>
FT & y_min ( )
inline

Returns the minimum y-coordinate.

Returns
The minimum y-coordinate.

◆ y_min() [2/2]

template<typename FT>
FT y_min ( ) const
inline

Returns the minimum y-coordinate (const version).

Returns
The minimum y-coordinate.

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