27#ifndef EASY3D_CORE_RECTANGLE_H
28#define EASY3D_CORE_RECTANGLE_H
32#include <easy3d/core/vec.h>
44 template <
typename FT>
53 x_min_ = std::min(q.x, p.x);
54 x_max_ = std::max(q.x, p.x);
55 y_min_ = std::min(q.y, p.y);
56 y_max_ = std::max(q.y, p.y);
68 : x_min_(std::
min(xmin, xmax))
69 , y_min_(std::
min(ymin, ymax))
70 , x_max_(std::
max(xmin, xmax))
71 , y_max_(std::
max(ymin, ymax))
99 FT
x_min()
const {
return x_min_; }
120 FT&
x() {
return x_min_; }
125 FT&
y() {
return y_min_; }
130 FT
x()
const {
return x_min_; }
135 FT
y()
const {
return y_min_; }
157 FT&
top() {
return y_min_; }
172 FT
left()
const {
return x_min_; }
177 FT
top()
const {
return y_min_; }
FT & y()
Returns the minimum y-coordinate (alias for y_min).
Definition rect.h:125
FT & x_min()
Returns the minimum x-coordinate.
Definition rect.h:79
FT x_min() const
Returns the minimum x-coordinate (const version).
Definition rect.h:99
FT x_max() const
Returns the maximum x-coordinate (const version).
Definition rect.h:109
FT & top()
Returns the top coordinate (alias for y_min).
Definition rect.h:157
FT height() const
Returns the height of the rectangle.
Definition rect.h:146
FT top() const
Returns the top coordinate (alias for y_min) (const version).
Definition rect.h:177
FT right() const
Returns the right coordinate (alias for x_max) (const version).
Definition rect.h:182
FT y() const
Returns the minimum y-coordinate (alias for y_min) (const version).
Definition rect.h:135
FT width() const
Returns the width of the rectangle.
Definition rect.h:141
FT left() const
Returns the left coordinate (alias for x_min) (const version).
Definition rect.h:172
Vec< 2, FT > top_right() const
Returns the position of the rectangle's top-right corner.
Definition rect.h:203
FT & bottom()
Returns the bottom coordinate (alias for y_max).
Definition rect.h:167
FT & x_max()
Returns the maximum x-coordinate.
Definition rect.h:89
GenericRect(const Vec< 2, FT > &p, const Vec< 2, FT > &q)
Constructs a rectangle from two points p and q.
Definition rect.h:52
FT y_min() const
Returns the minimum y-coordinate (const version).
Definition rect.h:104
FT & left()
Returns the left coordinate (alias for x_min).
Definition rect.h:152
FT & y_min()
Returns the minimum y-coordinate.
Definition rect.h:84
Vec< 2, FT > top_left() const
Returns the position of the rectangle's top-left corner.
Definition rect.h:193
FT & y_max()
Returns the maximum y-coordinate.
Definition rect.h:94
FT & x()
Returns the minimum x-coordinate (alias for x_min).
Definition rect.h:120
Vec< 2, FT > bottom_right() const
Returns the position of the rectangle's bottom-right corner.
Definition rect.h:198
FT & right()
Returns the right coordinate (alias for x_max).
Definition rect.h:162
Vec< 2, FT > center() const
Returns the center point of the rectangle.
Definition rect.h:225
FT y_max() const
Returns the maximum y-coordinate (const version).
Definition rect.h:114
Vec< 2, FT > max_point() const
Returns the maximum point of the rectangle.
Definition rect.h:219
Vec< 2, FT > bottom_left() const
Returns the position of the rectangle's bottom-left corner.
Definition rect.h:208
Vec< 2, FT > min_point() const
Returns the minimum point of the rectangle.
Definition rect.h:214
FT x() const
Returns the minimum x-coordinate (alias for x_min) (const version).
Definition rect.h:130
FT bottom() const
Returns the bottom coordinate (alias for y_max) (const version).
Definition rect.h:187
GenericRect(FT xmin, FT xmax, FT ymin, FT ymax)
Constructs a rectangle from its min coordinates (xmin and ymin) and max coordinates (xmax and ymax).
Definition rect.h:67
Base class for vector types. It provides generic functionality for N dimensional vectors.
Definition vec.h:30
Definition collider.cpp:182
FT min()
Function returning minimum representable value for a given type.
FT max()
Function returning maximum representable value for a given type.