Geometry¶
vtr_geometry¶
This file includes different geometry classes.
-
template<class T>
class 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.
-
void swap()¶
-
template<class T>
class 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
-
std::tuple<T, T, T, T> coordinates() const¶
Return the bottom left and top right coordinates.
- Returns:
[xmin, ymin, xmax, ymax]
-
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.
-
Rect<T> &operator+=(const Point<T> &rhs)¶
+= operator; translates all corners of the rectangle by rhs
-
Rect()¶
-
template<class T>
class Line¶ A 2D line.
It is constructed using a vector of the line points
-
template<class T>
class 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.
-
bool contains(Point<T> point) const¶