Geometry¶
vtr_geometry¶
This file include differents different geometry classes.
-
template<class
T
>
classvtr
::
Point
¶ A point in 2D space.
This class represents a point in 2D space. Hence, it holds both x and y components of the point.
Public Functions
-
void
swap
()¶ Swap x and y values.
Friends
-
friend friend bool operator== (Point< T > lhs, Point< T > rhs)
== operator
-
friend friend bool operator!= (Point< T > lhs, Point< T > rhs)
!= operator
-
friend friend bool operator< (Point< T > lhs, Point< T > rhs)
< operator
-
void
-
template<class
T
>
classvtr
::
Rect
¶ A 2D rectangle.
This class represents a 2D rectangle. It can be created with its 4 points or using the bottom left and the top rights ones only
Public Functions
-
Rect
()¶ default constructor
-
Rect
(Point<T> bottom_left_val, Point<T> top_right_val)¶ construct using the bottom left and the top right vertex
-
template<typename U = T, typename std::enable_if< std::is_integral< U >::value >::type...> Rect (Point< U > point)
Constructs a rectangle that only contains the given point.
Rect(p1).contains(p2) => p1 == p2 It is only enabled for integral types, because making this work for floating point types would be difficult and brittle. The following line only enables the constructor if std::is_integral<T>::value == true
-
bool
contains
(Point<T> point) const¶ Returns true if the point is fully contained within the rectangle (excluding the top-right edges)
-
bool
strictly_contains
(Point<T> point) const¶ Returns true if the point is strictly contained within the region (excluding all edges)
-
bool
coincident
(Point<T> point) const¶ Returns true if the point is coincident with the rectangle (including the top-right edges)
-
bool
contains
(const Rect<T> &other) const¶ Returns true if other is contained within the rectangle (including all edges)
-
bool
empty
() const¶ Checks whether the rectangle is empty.
Returns true if no points are contained in the rectangle rect.empty() => not exists p. rect.contains(p) This also implies either the width or height is 0.
Friends
-
friend friend bool operator== (const Rect< T > &lhs, const Rect< T > &rhs)
== operator
-
friend friend bool operator!= (const Rect< T > &lhs, const Rect< T > &rhs)
!= operator
-
-
template<class
T
>
classvtr
::
RectUnion
¶ A union of 2d rectangles.
Public Functions
-
bool
contains
(Point<T> point) const¶ Returns true if the point is fully contained within the region (excluding top-right edges)
-
bool
strictly_contains
(Point<T> point) const¶ Returns true if the point is strictly contained within the region (excluding all edges)
-
bool
coincident
(Point<T> point) const¶ Returns true if the point is coincident with the region (including the top-right edges)
-
rect_range
rects
() const¶ Returns a range of all constituent rectangles.
Friends
-
friend friend bool operator== (const RectUnion< T > &lhs, const RectUnion< T > &rhs)
Checks whether two RectUnions have identical representations.
Note: does not check whether the representations they are equivalent
-
friend friend bool operator!= (const RectUnion< T > &lhs, const RectUnion< T > &rhs)
!= operator
-
bool