|  | Scanframe Modular Application 0.1.0
    | 
Class to store and manipulate a rectangle based on floating point values. More...
#include <TRectangle2D.h>

| Classes | |
| union | data_type | 
| Rectangle structure for binary storage purposes.  More... | |
| Public Types | |
| typedef T | value_type | 
| Type accessible when implemented. | |
| Public Member Functions | |
| TRectangle2D ()=default | |
| Default constructor. | |
| TRectangle2D (const TRectangle2D &rect) | |
| Copy constructor. | |
| TRectangle2D (const TRectangle2D &&rect) noexcept | |
| Move constructor. | |
| TRectangle2D (T left, T bottom, T right, T top) | |
| Initializing constructor. | |
| TRectangle2D (std::initializer_list< T > list) | |
| Initializer list constructor. | |
| TRectangle2D (const TVector2D< T > &loLeft, const TVector2D< T > &upRight) | |
| An initializing constructor using two points. | |
| TRectangle2D & | assign (const TRectangle2D &) | 
| Assigns new values from the passed instance. | |
| TRectangle2D & | assign (T left, T bottom, T right, T top) | 
| Assigns new coordinate values. | |
| TRectangle2D & | assign (const TVector2D< T > &loLeft, const TVector2D< T > &upRight) | 
| Assigns new coordinate using two points. | |
| TRectangle2D & | assignWidthHeight (T left, T bottom, T w, T h) | 
| Assigns new coordinates using position x, y, width and height values. | |
| TRectangle2D & | assignWidthHeight (const TVector2D< T > &bottom_left, const TVector2D< T > &size) | 
| Assigns new coordinates using position and size vector. | |
| void | clear () | 
| Empties the rectangle setting it to the initial state. | |
| bool | isEmpty () const | 
| Tests if all values are near zero, according to the tolerance value. | |
| bool | isEqual (const TRectangle2D &other, T tol=tolerance) const | 
| Compare passes rectangle with this instance taking the tolerance value in to account. | |
| bool | operator== (const TRectangle2D &) const | 
| Call the isEqual() function to compare. | |
| bool | operator!= (const TRectangle2D &) const | 
| Call the isEqual() function to compare. | |
| bool | contains (const TVector2D< T > &point) const | 
| Returns true when the passed point represented by a vector resides within this rectangle. | |
| bool | contains (const TRectangle2D &other) const | 
| Returns true when the passed rectangle resides within this rectangle. | |
| bool | touches (const TRectangle2D &other) const | 
| Returns true when the passed rectangle overlaps with this rectangle. | |
| TVector2D< T > | bottomLeft () const | 
| Gets the bottom-left corner of the rectangle as a vector. | |
| TVector2D< T > | topRight () const | 
| Gets the top-right corner of the rectangle as a vector. | |
| TVector2D< T > | bottomRight () const | 
| Gets the bottom-right corner of the rectangle as a vector. | |
| TVector2D< T > | topLeft () const | 
| Gets the top-left corner of the rectangle as a vector. | |
| T | width () const | 
| Gets the width of the rectangle. | |
| T | height () const | 
| Gets the height of the rectangle. | |
| TVector2D< T > | Size () const | 
| Gets the height and width of the rectangle as a vector. | |
| T | area () const | 
| Gets the area formed by the rectangle's width and height. | |
| TVector2D< T > | center () const | 
| Gets the center of the rectangle as a vector. | |
| TRectangle2D & | normalize () | 
| Normalizes this instance so that top-right and bottom-left are correct. | |
| TRectangle2D | normalized () const | 
| Gets a normalized instance of this instance so that top-right and bottom-left are correct. | |
| TRectangle2D & | offset (T dx, T dy) | 
| Offsets this instance by the passed values x and y keeping the same size. | |
| TRectangle2D | offsetBy (T dx, T dy) const | 
| Gets an instance offset by the passed values x and y keeping the same size. | |
| TRectangle2D | movedTo (T x, T y) | 
| Gets a moved instance from this instance where left-bottom represented by the passed values x and y having the same size. | |
| TRectangle2D & | moveTo (T x, T y) | 
| Moves this instance to a different left-bottom represented by the passed values x and y having the same size. | |
| TRectangle2D & | operator+= (const TVector2D< T > &delta) | 
| Offsets this instance using the passed delta vector as a positive. | |
| TRectangle2D & | operator-= (const TVector2D< T > &delta) | 
| Offsets this instance using the passed delta vector as a negative. | |
| TRectangle2D & | inflate (T dx, T dy) | 
| Inflates this instance using the passed delta values for x and y. | |
| TRectangle2D & | inflate (const TVector2D< T > &delta) | 
| Inflates this instance using the passed delta vector (x, y). | |
| TRectangle2D | inflatedBy (T dx, T dy) const | 
| Gets an inflated rectangle using the passed delta values for x and y. | |
| TRectangle2D | inflatedBy (const TVector2D< T > &delta) const | 
| Gets the inflated instance using the passed delta vector (x, y). | |
| TRectangle2D & | operator&= (const TRectangle2D &other) | 
| Sets this instance to the overlapping part of both rectangles. | |
| TRectangle2D | operator& (const TRectangle2D &other) const | 
| Gets an instance of the overlapping part of both rectangles. | |
| TRectangle2D & | operator|= (const TRectangle2D &other) | 
| Sets this instance to the combined rectangle containing both rectangles. | |
| TRectangle2D | operator| (const TRectangle2D &other) const | 
| Gets an instance of the combined rectangle containing both rectangles. | |
| std::string | toString () const | 
| Gets the string representation of the rectangle formed like '(left, bottom, right, top)'. | |
| TRectangle2D & | fromString (const std::string &s, bool ignore_err=false) noexcept(false) | 
| Gets rectangle value from the string representation formed like '(left, bottom, right, top)'. Throws an exception when the string is not in the correct format. | |
| Static Public Attributes | |
| static constexpr auto | tolerance = TVector2D<T>::tolerance | 
| Tolerance for when comparing in the equal operator. Used as: std::fabs(x1 - x2) < tolerance. | |
| Protected Types | |
| typedef TVector2D< T >::data_type::point_type | point_type | 
| Use the same point type as the one of the 2D vector. | |
| Protected Attributes | |
| union sf::TRectangle2D::data_type | _data | 
Class to store and manipulate a rectangle based on floating point values.
| 
 | protected | 
Use the same point type as the one of the 2D vector.
| typedef T sf::TRectangle2D< T >::value_type | 
Type accessible when implemented.
| 
 | default | 
Default constructor.
| sf::TRectangle2D< T >::TRectangle2D | ( | const TRectangle2D< T > & | rect | ) | 
Copy constructor.
| 
 | noexcept | 
Move constructor.
| sf::TRectangle2D< T >::TRectangle2D | ( | T | left, | 
| T | bottom, | ||
| T | right, | ||
| T | top | ||
| ) | 
Initializing constructor.
| sf::TRectangle2D< T >::TRectangle2D | ( | std::initializer_list< T > | list | ) | 
Initializer list constructor.
| sf::TRectangle2D< T >::TRectangle2D | ( | const TVector2D< T > & | loLeft, | 
| const TVector2D< T > & | upRight | ||
| ) | 
An initializing constructor using two points.
| T sf::TRectangle2D< T >::area | ( | ) | const | 
Gets the area formed by the rectangle's width and height.
| TRectangle2D & sf::TRectangle2D< T >::assign | ( | const TRectangle2D< T > & | ) | 
Assigns new values from the passed instance.
| TRectangle2D & sf::TRectangle2D< T >::assign | ( | const TVector2D< T > & | loLeft, | 
| const TVector2D< T > & | upRight | ||
| ) | 
Assigns new coordinate using two points.
| TRectangle2D & sf::TRectangle2D< T >::assign | ( | T | left, | 
| T | bottom, | ||
| T | right, | ||
| T | top | ||
| ) | 
Assigns new coordinate values.
| TRectangle2D & sf::TRectangle2D< T >::assignWidthHeight | ( | const TVector2D< T > & | bottom_left, | 
| const TVector2D< T > & | size | ||
| ) | 
Assigns new coordinates using position and size vector.
| TRectangle2D & sf::TRectangle2D< T >::assignWidthHeight | ( | T | left, | 
| T | bottom, | ||
| T | w, | ||
| T | h | ||
| ) | 
Assigns new coordinates using position x, y, width and height values.
| TVector2D< T > sf::TRectangle2D< T >::bottomLeft | ( | ) | const | 
Gets the bottom-left corner of the rectangle as a vector.
| TVector2D< T > sf::TRectangle2D< T >::bottomRight | ( | ) | const | 
Gets the bottom-right corner of the rectangle as a vector.
| TVector2D< T > sf::TRectangle2D< T >::center | ( | ) | const | 
Gets the center of the rectangle as a vector.
| void sf::TRectangle2D< T >::clear | ( | ) | 
Empties the rectangle setting it to the initial state.
| bool sf::TRectangle2D< T >::contains | ( | const TRectangle2D< T > & | other | ) | const | 
Returns true when the passed rectangle resides within this rectangle.
| bool sf::TRectangle2D< T >::contains | ( | const TVector2D< T > & | point | ) | const | 
Returns true when the passed point represented by a vector resides within this rectangle.
| TRectangle2D & sf::TRectangle2D< T >::fromString | ( | const std::string & | s, | 
| bool | ignore_err = false | ||
| ) | 
Gets rectangle value from the string representation formed like '(left, bottom, right, top)'. Throws an exception when the string is not in the correct format.
| s | Formatted string to read the values from. | 
| ignore_err | Determines to throw an exception or not. | 
| std::invalid_argument | 
| T sf::TRectangle2D< T >::height | ( | ) | const | 
Gets the height of the rectangle.
| TRectangle2D & sf::TRectangle2D< T >::inflate | ( | const TVector2D< T > & | delta | ) | 
Inflates this instance using the passed delta vector (x, y).
| TRectangle2D & sf::TRectangle2D< T >::inflate | ( | T | dx, | 
| T | dy | ||
| ) | 
Inflates this instance using the passed delta values for x and y.
| TRectangle2D sf::TRectangle2D< T >::inflatedBy | ( | const TVector2D< T > & | delta | ) | const | 
Gets the inflated instance using the passed delta vector (x, y).
| TRectangle2D sf::TRectangle2D< T >::inflatedBy | ( | T | dx, | 
| T | dy | ||
| ) | const | 
Gets an inflated rectangle using the passed delta values for x and y.
| bool sf::TRectangle2D< T >::isEmpty | ( | ) | const | 
| bool sf::TRectangle2D< T >::isEqual | ( | const TRectangle2D< T > & | other, | 
| T | tol = tolerance | ||
| ) | const | 
| TRectangle2D sf::TRectangle2D< T >::movedTo | ( | T | x, | 
| T | y | ||
| ) | 
Gets a moved instance from this instance where left-bottom represented by the passed values x and y having the same size.
| TRectangle2D & sf::TRectangle2D< T >::moveTo | ( | T | x, | 
| T | y | ||
| ) | 
Moves this instance to a different left-bottom represented by the passed values x and y having the same size.
| TRectangle2D & sf::TRectangle2D< T >::normalize | ( | ) | 
Normalizes this instance so that top-right and bottom-left are correct.
| TRectangle2D sf::TRectangle2D< T >::normalized | ( | ) | const | 
Gets a normalized instance of this instance so that top-right and bottom-left are correct.
| TRectangle2D & sf::TRectangle2D< T >::offset | ( | T | dx, | 
| T | dy | ||
| ) | 
Offsets this instance by the passed values x and y keeping the same size.
| TRectangle2D sf::TRectangle2D< T >::offsetBy | ( | T | dx, | 
| T | dy | ||
| ) | const | 
Gets an instance offset by the passed values x and y keeping the same size.
| bool sf::TRectangle2D< T >::operator!= | ( | const TRectangle2D< T > & | ) | const | 
| TRectangle2D sf::TRectangle2D< T >::operator& | ( | const TRectangle2D< T > & | other | ) | const | 
Gets an instance of the overlapping part of both rectangles.
| TRectangle2D & sf::TRectangle2D< T >::operator&= | ( | const TRectangle2D< T > & | other | ) | 
Sets this instance to the overlapping part of both rectangles.
| TRectangle2D & sf::TRectangle2D< T >::operator+= | ( | const TVector2D< T > & | delta | ) | 
Offsets this instance using the passed delta vector as a positive.
| TRectangle2D & sf::TRectangle2D< T >::operator-= | ( | const TVector2D< T > & | delta | ) | 
Offsets this instance using the passed delta vector as a negative.
| bool sf::TRectangle2D< T >::operator== | ( | const TRectangle2D< T > & | ) | const | 
| TRectangle2D sf::TRectangle2D< T >::operator| | ( | const TRectangle2D< T > & | other | ) | const | 
Gets an instance of the combined rectangle containing both rectangles.
| TRectangle2D & sf::TRectangle2D< T >::operator|= | ( | const TRectangle2D< T > & | other | ) | 
Sets this instance to the combined rectangle containing both rectangles.
| TVector2D< T > sf::TRectangle2D< T >::Size | ( | ) | const | 
Gets the height and width of the rectangle as a vector.
| TVector2D< T > sf::TRectangle2D< T >::topLeft | ( | ) | const | 
Gets the top-left corner of the rectangle as a vector.
| TVector2D< T > sf::TRectangle2D< T >::topRight | ( | ) | const | 
Gets the top-right corner of the rectangle as a vector.
| std::string sf::TRectangle2D< T >::toString | ( | ) | const | 
Gets the string representation of the rectangle formed like '(left, bottom, right, top)'.
| bool sf::TRectangle2D< T >::touches | ( | const TRectangle2D< T > & | other | ) | const | 
Returns true when the passed rectangle overlaps with this rectangle.
| T sf::TRectangle2D< T >::width | ( | ) | const | 
Gets the width of the rectangle.
| 
 | protected | 
| 
 | staticconstexpr | 
Tolerance for when comparing in the equal operator. Used as: std::fabs(x1 - x2) < tolerance.