|
Recti 1.2.4
|
#include <point.hpp>
Public Types | |
| using | value_type = T1 |
Public Member Functions | |
| constexpr | Point () |
| Default constructor. | |
| constexpr | Point (T1 xcoord, T2 ycoord) noexcept |
| Construct a new Point object. | |
| constexpr auto | xcoord () const -> const T1 & |
| Gets the x coordinate of this Point. | |
| constexpr auto | ycoord () const -> const T2 & |
| Gets the y coordinate of this Point. | |
Comparison operators | |
definie ==, !=, <, >, <=, >=. | |
| template<typename U1 , typename U2 > | |
| constexpr auto | operator== (const Point< U1, U2 > &rhs) const -> bool |
| Compares this Point object with another Point object for equality. | |
| template<typename U1 , typename U2 > | |
| 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. | |
| template<typename U1 , typename U2 > | |
| constexpr auto | operator!= (const Point< U1, U2 > &rhs) const -> bool |
| Compares this Point object with another Point object for inequality. | |
Arithmetic operators | |
definie +, -, *, /, +=, -=, *=, /=, etc. | |
| template<typename U1 , typename U2 > | |
| CONSTEXPR14 auto | operator+= (const Vector2< U1, U2 > &right_point) -> Self & |
| Adds a vector (translation) to this Point. | |
| template<typename U1 , typename U2 > | |
| 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< T2, T1 > |
| flip_xy according to xcoord-ycoord diagonal line | |
| constexpr auto | flip_y () const -> Point< T1, T2 > |
| flip according to ycoord-axis | |
| template<typename U1 , typename U2 > | |
| constexpr auto | overlaps (const Point< U1, U2 > &other_point) const -> bool |
| template<typename U1 , typename U2 > | |
| constexpr auto | intersect_with (const Point< U1, U2 > &other_point) const |
| template<typename U1 , typename U2 > | |
| constexpr auto | hull_with (const Point< U1, U2 > &other_point) const |
| template<typename U1 , typename U2 > | |
| constexpr auto | contains (const Point< U1, U2 > &other_point) const -> bool |
| template<typename U1 , typename U2 > | |
| constexpr auto | blocks (const Point< U1, U2 > &other_point) const -> bool |
| template<typename U1 , typename U2 > | |
| constexpr auto | min_dist_with (const Point< U1, U2 > &other_point) const |
| minimum distance between this point and another point | |
| template<typename U1 , typename U2 > | |
| constexpr auto | min_dist_change_with (Point< U1, U2 > &other_point) |
| minimum distance between this point and another point | |
| template<typename T > | |
| constexpr auto | enlarge_with (const T &value) const |
Enlarge the point by value | |
| template<typename U1 , typename U2 > | |
| constexpr auto | nearest_to (const Point< U1, U2 > &other_point) const |
| constexpr auto | rotates () const -> Point< T1, T2 > |
| Rotate the point by 45 degrees (used for ManhattanArc). | |
| constexpr auto | inv_rotates () const -> Point< T1, T2 > |
| 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. | |
| template<typename U1 , typename U2 > | |
| constexpr auto | operator+ (Point lhs, const Vector2< U1, U2 > &vector) |
| Adds a vector (translation) to this Point. | |
| template<typename U1 , typename U2 > | |
| constexpr auto | operator- (Point lhs, const Vector2< U1, U2 > &vector) |
| template<class Stream > | |
| auto | operator<< (Stream &output_stream, const Point &obj) -> Stream & |
| CONSTEXPR14 auto | get_xcoord () -> T1 & |
| Returns a mutable reference to the x-coordinate of the point. | |
| constexpr auto | get_xcoord () const -> const T1 & |
| Returns a const reference to the x-coordinate of the point. | |
| CONSTEXPR14 auto | get_ycoord () -> T2 & |
| Returns a mutable reference to the y-coordinate of the point. | |
| constexpr auto | get_ycoord () const -> const T2 & |
| Returns a const reference to the y-coordinate of the point. | |
The Point class is a template class that represents a point in a 2D coordinate system. It has two template parameters, T1 and T2, which can be either int, Interval, or another Point. The Point class provides various operations and functionalities for working with points, such as comparison operators, arithmetic operators, flipping, overlap checking, distance calculation, and more.
| using recti::Point< T1, T2 >::value_type = T1 |
|
inlineconstexpr |
Default constructor.
|
inlineconstexprnoexcept |
Construct a new Point object.
This is a constructor for the Point class. It takes two parameters, xcoord and ycoord, and constructs a new Point object with those values. The parameters are passed as rvalue references (T1&& and T2&&) to allow for efficient move semantics. The constructor is marked as constexpr to indicate that it can be evaluated at compile-time if the arguments are compile-time constants.
| [in] | xcoord | - x coordinate. |
| [in] | ycoord | - y coordinate. |
|
inlineconstexpr |
Checks if this point blocks another point.
| U1 | - The type of the x-coordinate for this point. |
| U2 | - The type of the y-coordinate for this point. |
| other_point | - The other point to check for containment. |
|
inlineconstexpr |
Checks if this point contains another point.
| U1 | - The type of the x-coordinate for this point. |
| U2 | - The type of the y-coordinate for this point. |
| other_point | - The other point to check for containment. |
|
inlineconstexpr |
Enlarge the point by value
| [in] | value | The value to enlarge |
Interval object.
|
inlineconstexpr |
flip_xy according to xcoord-ycoord diagonal line
|
inlineconstexpr |
flip according to ycoord-axis
|
inlineconstexpr |
Calculate the center of the point.
|
inlineprotected |
Returns a mutable reference to the x-coordinate of the point.
|
inlineconstexprprotected |
Returns a const reference to the x-coordinate of the point.
|
inlineprotected |
Returns a mutable reference to the y-coordinate of the point.
|
inlineconstexprprotected |
Returns a const reference to the y-coordinate of the point.
|
inlineconstexpr |
Return the hull (bounding box) of this point and another point.
| U1 | - The x-coordinate type of the other point. |
| U2 | - The y-coordinate type of the other point. |
| other_point | - The other point to check for hull. |
|
inlineconstexpr |
Checks if this point intersects with another point.
| U1 | - The x-coordinate type of the other point. |
| U2 | - The y-coordinate type of the other point. |
| other_point | - The other point to check for intersection. |
|
inlineconstexpr |
Inverse rotate the point (used for ManhattanArc).
|
inlineconstexpr |
Calculate the lower corner of the point.
|
inlineconstexpr |
measure (area, volume etc.)
The function returns the measure (area, volume etc.).
|
inlineconstexpr |
minimum distance between this point and another point
| U1 | - The x-coordinate type of the other point. |
| U2 | - The y-coordinate type of the other point. |
| other_point | - The other point to calculate the minimum distance from. |
|
inlineconstexpr |
minimum distance between this point and another point
| U1 | - The x-coordinate type of the other point. |
| U2 | - The y-coordinate type of the other point. |
| other_point | - The other point to calculate the minimum distance from. |
|
inlineconstexpr |
Return the point in this object that is nearest to the given point.
| other_point | - The other point. |
|
inlineconstexpr |
Compares this Point object with another Point object for inequality.
This operator checks if the x and y coordinates of this Point are not equal to the x and y coordinates of the given Point object. It allows Points to be compared for inequality in a generic way.
| U1 | - The type of x coordinate for this Point. |
| U2 | - The type of y coordinate for this Point. |
| [in] | rhs | - The other Point object to compare against. |
|
inline |
Adds a vector (translation) to this Point.
Translates this Point by the given vector's x and y components.
| U1 | - The x coordinate type of the vector. |
| U2 | - The y coordinate type of the vector. |
| [in] | right_point | - The vector to translate this Point by. |
|
inlineconstexpr |
Calculates the displacement vector between this point and another point.
| [in] | other_point | The other point to calculate the displacement from |
|
inline |
Subtracts a vector (translation) from this Point.
Translates this Point by the given vector's x and y components.
| U1 | - The x coordinate type of the vector. |
| U2 | - The y coordinate type of the vector. |
| [in] | right_point | - The vector to translate this Point by. |
|
inlineconstexpr |
Compares this Point object with another Point object to check if it is less than.
This operator checks if this Point is less than the given Point by comparing their x and y coordinates. It allows Points to be compared in a generic way.
| U1 | - The type of x coordinate for this Point. |
| U2 | - The type of y coordinate for this Point. |
| [in] | rhs | - The other Point to compare against. |
|
inlineconstexpr |
Compares this Point object with another Point object for equality.
This operator checks if the x and y coordinates of this Point are equal to the x and y coordinates of the given Point object. It allows Points to be compared for equality in a generic way.
| U1 | - The type of x coordinate for this Point. |
| U2 | - The type of y coordinate for this Point. |
| [in] | rhs | - The other Point object to compare against. |
|
inlineconstexpr |
Checks if this point overlaps with another point.
| U1 | - The type of the x-coordinate for this point. |
| U2 | - The type of the y-coordinate for this point. |
| other_point | - The other point to check for overlap. |
|
inlineconstexpr |
Rotate the point by 45 degrees (used for ManhattanArc).
|
inlineconstexpr |
Calculate the upper corner of the point.
|
inlineconstexpr |
Gets the x coordinate of this Point.
|
inlineconstexpr |
Gets the y coordinate of this Point.
|
friend |
Adds a vector (translation) to this Point.
Translates this Point by the given vector's x and y components.
| U1 | - The x coordinate type of the vector. |
| U2 | - The y coordinate type of the vector. |
| [in] | vector | - The vector to translate this Point by. |
|
friend |
Subtracts a vector (translation) from this Point.
Translates this Point by the given vector's x and y components.
| U1 | - The x coordinate type of this Point. |
| U2 | - The y coordinate type of this Point. |
| [in] | vector | - The vector to translate this Point by. |
|
friend |
Outputs the point object to the given output stream.
| [out] | output_stream | The output stream to write the point to. |
| [in] | obj | The point object to output. |