Recti 1.2.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
recti::Rectangle< T > Struct Template Reference

Rectangle (Rectilinear) More...

#include <recti.hpp>

Inheritance diagram for recti::Rectangle< T >:
Inheritance graph
[legend]
Collaboration diagram for recti::Rectangle< T >:
Collaboration graph
[legend]

Public Member Functions

constexpr Rectangle (Interval< T > xcoord, Interval< T > ycoord) noexcept
 Construct a new Rectangle object.
 
constexpr Rectangle (Point< Interval< T > > base) noexcept
 Construct a new Rectangle object from the base object (implicitly)
 
constexpr auto ll () const -> Point< T >
 lower left corner
 
constexpr auto ur () const -> Point< T >
 upper right corner
 
constexpr auto area () const -> T
 area
 
- Public Member Functions inherited from recti::Point< Interval< T > >
constexpr Point ()
 Default constructor.
 
constexpr Point (Interval< T > xcoord, Interval< T > ycoord) noexcept
 Construct a new Point object.
 
constexpr auto xcoord () const -> const Interval< T > &
 Gets the x coordinate of this Point.
 
constexpr auto ycoord () const -> const Interval< T > &
 Gets the y coordinate of this Point.
 
constexpr auto operator== (const Point< U1, U2 > &rhs) const -> bool
 Compares this Point object with another Point object for equality.
 
constexpr auto operator< (const Point< U1, U2 > &rhs) const -> bool
 Compares this Point object with another Point object to check if it is less than.
 
constexpr auto operator!= (const Point< U1, U2 > &rhs) const -> bool
 Compares this Point object with another Point object for inequality.
 
CONSTEXPR14 auto operator+= (const Vector2< U1, U2 > &right_point) -> Self &
 Adds a vector (translation) to this Point.
 
CONSTEXPR14 auto operator-= (const Vector2< U1, U2 > &right_point) -> Self &
 Subtracts a vector (translation) from this Point.
 
constexpr auto operator- (const Self &other_point) const
 Calculates the displacement vector between this point and another point.
 
constexpr auto measure () const
 measure (area, volume etc.)
 
constexpr auto flip_xy () const -> Point< Interval< T >, Interval< T > >
 flip_xy according to xcoord-ycoord diagonal line
 
constexpr auto flip_y () const -> Point< Interval< T >, Interval< T > >
 flip according to ycoord-axis
 
constexpr auto overlaps (const Point< U1, U2 > &other_point) const -> bool
 
constexpr auto intersect_with (const Point< U1, U2 > &other_point) const
 
constexpr auto hull_with (const Point< U1, U2 > &other_point) const
 
constexpr auto contains (const Point< U1, U2 > &other_point) const -> bool
 
constexpr auto blocks (const Point< U1, U2 > &other_point) const -> bool
 
constexpr auto min_dist_with (const Point< U1, U2 > &other_point) const
 minimum distance between this point and another point
 
constexpr auto min_dist_change_with (Point< U1, U2 > &other_point)
 minimum distance between this point and another point
 
constexpr auto enlarge_with (const T &value) const
 Enlarge the point by value
 
constexpr auto nearest_to (const Point< U1, U2 > &other_point) const
 
constexpr auto rotates () const -> Point< Interval< T >, Interval< T > >
 Rotate the point by 45 degrees (used for ManhattanArc).
 
constexpr auto inv_rotates () const -> Point< Interval< T >, Interval< T > >
 Inverse rotate the point (used for ManhattanArc).
 
constexpr auto get_center () const
 Calculate the center of the point.
 
constexpr auto lower_corner () const
 Calculate the lower corner of the point.
 
constexpr auto upper_corner () const
 Calculate the upper corner of the point.
 

Additional Inherited Members

- Public Types inherited from recti::Point< Interval< T > >
using value_type = Interval< T >
 
- Protected Member Functions inherited from recti::Point< Interval< T > >
CONSTEXPR14 auto get_xcoord () -> Interval< T > &
 Returns a mutable reference to the x-coordinate of the point.
 
constexpr auto get_xcoord () const -> const Interval< T > &
 Returns a const reference to the x-coordinate of the point.
 
CONSTEXPR14 auto get_ycoord () -> Interval< T > &
 Returns a mutable reference to the y-coordinate of the point.
 
constexpr auto get_ycoord () const -> const Interval< T > &
 Returns a const reference to the y-coordinate of the point.
 

Detailed Description

template<typename T>
struct recti::Rectangle< T >

Rectangle (Rectilinear)

The struct Rectangle is inheriting from the Point<Interval<T>> class. This means that Rectangle will have all the member variables and member functions of Point<Interval<T>>. It is using the Interval<T> template parameter to define the type of the x and y coordinates of the rectangle.

+-----------------------+
| Recti |
+-----------------------+
| |
| +----------+ |
| | | | A Rectangle template class
| | Rect | | inheriting from Point<Interval<T>>
| | | | with functions to get
| +----------+ | lower-left (ll) and upper-right (ur)
| ll()----->o--------+ corners, and calculate area
| ur()----->o--------+
| | |
+-----------------------+ |
|
+-----------------------+ |
| ll() function | |
| Returns Point<T> | |
| at lower-left corner | |
+-----------------------+ |
|
+-----------------------+ |
| ur() function | |
| Returns Point<T> | |
| at upper-right corner | |
+-----------------------+ |
|
+-----------------------+ |
| area() function | |
| Calculates rectangle | |
| area using length() | |
+-----------------------+
Point.
Definition point.hpp:30
constexpr auto lower(const U &obj)
Calculates the lower corner of an object.
Definition generic.hpp:281
constexpr auto upper(const U &obj)
Calculates the upper corner of an object.
Definition generic.hpp:299
Rectangle (Rectilinear)
Definition recti.hpp:61
constexpr auto area() const -> T
area
Definition recti.hpp:115
constexpr auto ll() const -> Point< T >
lower left corner
Definition recti.hpp:91
constexpr auto ur() const -> Point< T >
upper right corner
Definition recti.hpp:105
Template Parameters
T

Constructor & Destructor Documentation

◆ Rectangle() [1/2]

template<typename T >
constexpr recti::Rectangle< T >::Rectangle ( Interval< T >  xcoord,
Interval< T >  ycoord 
)
inlineconstexprnoexcept

Construct a new Rectangle object.

Parameters
[in]xcoord
[in]ycoord

◆ Rectangle() [2/2]

template<typename T >
constexpr recti::Rectangle< T >::Rectangle ( Point< Interval< T > >  base)
inlineconstexprnoexcept

Construct a new Rectangle object from the base object (implicitly)

Note: intentionally allow implicit conversion

Parameters
[in]base

Member Function Documentation

◆ area()

template<typename T >
constexpr auto recti::Rectangle< T >::area ( ) const -> T
inlineconstexpr

area

The area() function is a member function of the Rectangle struct. It calculates and returns the area of the rectangle.

Returns
constexpr T

◆ ll()

template<typename T >
constexpr auto recti::Rectangle< T >::ll ( ) const -> Point<T>
inlineconstexpr

lower left corner

The ll() function is a member function of the Rectangle struct. It returns a Point<T> object representing the lower left corner of the rectangle.

Returns
Point<T>

◆ ur()

template<typename T >
constexpr auto recti::Rectangle< T >::ur ( ) const -> Point<T>
inlineconstexpr

upper right corner

The ur() function is a member function of the Rectangle struct. It returns a Point<T> object representing the upper right corner of the rectangle. It does this by accessing the xcoord() and ycoord() member functions of the Rectangle object and calling their ub() member functions to get the upper bound values. These values are then used to construct a new Point<T> object representing the upper right corner.

Returns
Point<T>

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