12 std::array<double, 2> xy_{};
17 constexpr double x() const noexcept {
return xy_[0]; }
18 constexpr double y() const noexcept {
return xy_[1]; }
19 double *
data() noexcept {
return xy_.data(); }
20 const double *
data() const noexcept {
return xy_.data(); }
21 constexpr bool isNull()
const {
return x() == 0 &&
y() == 0; }
54 return a.x() ==
b.x() &&
a.y() ==
b.y();
60 double x0_ = 0, y0_ = 0, w_ = 0, h_ = 0;
63 constexpr Box2() =
default;
65 : x0_(
a.
x()), y0_(
a.
y()), w_(
b.
x() -
a.
x()), h_(
b.
y() -
a.
y())
68 constexpr double left()
const {
return x0_; }
69 constexpr double right()
const {
return x0_ + w_; }
70 constexpr double top()
const {
return y0_; }
71 constexpr double bottom()
const {
return y0_ + h_; }
72 constexpr double width()
const {
return w_; }
73 constexpr double height()
const {
return h_; }
74 Box2(
double x,
double y,
double w,
double h) : x0_(
x), y0_(
y), w_(
w), h_(
h) {}
80 bool isValid()
const {
return w_ > 0 && h_ > 0; }
81 bool isEmpty()
const {
return w_ <= 0 || h_ <= 0; }
82 bool isNull()
const {
return w_ == 0 && h_ == 0; }
96 double x = std::max(
left(),
b.left()),
y = std::max(
top(),
b.top()),
97 r = std::min(
right(),
b.right()),
t = std::min(
bottom(),
b.bottom());
104 constexpr Point2 center()
const {
return {x0_ + w_ * .5, y0_ + h_ * .5}; }
107 return {{std::min(x0_,
b.x0_), std::min(y0_,
b.y0_)},
108 {std::max(
right(),
b.right()), std::max(
bottom(),
b.bottom())}};
112 double x = 0,
y = 0,
z = 0;
114static_assert(std::is_standard_layout<Point3>::value &&
sizeof(
Point3) == 3 *
sizeof(
double));
115static_assert(std::is_standard_layout<Point2>::value &&
sizeof(
Point2) == 2 *
sizeof(
double));
Definition geometry.hpp:59
bool contains(double x, double y) const
Definition geometry.hpp:85
constexpr double left() const
Definition geometry.hpp:68
constexpr Point2 center() const
Definition geometry.hpp:104
Box2(double x, double y, double w, double h)
Definition geometry.hpp:74
bool isValid() const
Definition geometry.hpp:80
bool isEmpty() const
Definition geometry.hpp:81
Box2 adjusted(double l, double t, double r, double b) const
Definition geometry.hpp:100
Box2 normalized() const
Definition geometry.hpp:75
bool intersects(Box2 b) const
Definition geometry.hpp:90
constexpr double bottom() const
Definition geometry.hpp:71
bool contains(Point2 p) const
Definition geometry.hpp:86
constexpr double width() const
Definition geometry.hpp:72
bool isNull() const
Definition geometry.hpp:82
Box2 intersected(Box2 b) const
Definition geometry.hpp:94
Box2 united(Box2 b) const
Definition geometry.hpp:105
Point2 topLeft() const
Definition geometry.hpp:84
constexpr double right() const
Definition geometry.hpp:69
constexpr double top() const
Definition geometry.hpp:70
constexpr Box2(Point2 a, Point2 b)
Definition geometry.hpp:64
constexpr double height() const
Definition geometry.hpp:73
Point2 bottomRight() const
Definition geometry.hpp:83
Definition geometry.hpp:11
constexpr Point2(double x, double y)
Definition geometry.hpp:16
friend constexpr bool operator!=(Point2 a, Point2 b)
Definition geometry.hpp:56
static constexpr double dotProduct(Point2 a, Point2 b)
Definition geometry.hpp:22
friend constexpr Point2 operator/(Point2 a, double s)
Definition geometry.hpp:51
const double * data() const noexcept
Definition geometry.hpp:20
friend constexpr Point2 operator-(Point2 a, Point2 b)
Definition geometry.hpp:48
Point2 & operator+=(Point2 p)
Definition geometry.hpp:35
constexpr double y() const noexcept
Definition geometry.hpp:18
friend constexpr Point2 operator*(double s, Point2 a)
Definition geometry.hpp:50
friend constexpr Point2 operator+(Point2 a, Point2 b)
Definition geometry.hpp:47
friend constexpr bool operator==(Point2 a, Point2 b)
Definition geometry.hpp:52
Point2 & operator*=(double s)
Definition geometry.hpp:23
constexpr double x() const noexcept
Definition geometry.hpp:17
Point2 & operator-=(Point2 p)
Definition geometry.hpp:41
friend constexpr Point2 operator*(Point2 a, double s)
Definition geometry.hpp:49
double * data() noexcept
Definition geometry.hpp:19
constexpr bool isNull() const
Definition geometry.hpp:21
constexpr Point2()=default
Point2 & operator/=(double s)
Definition geometry.hpp:29
DiagramType t
Definition diagramspec.cpp:23
double s
Scene px per model length unit.
Definition inletdrawingview.cpp:95
ArrowPlacement p
Definition linesymbollayer.cpp:29
int h
Definition mesh2dresultsexport.cpp:477
int w
Definition mesh2dresultsexport.cpp:477
Definition qtcdtstorage.h:9
Definition geometry.hpp:111
double x
Definition geometry.hpp:112
double z
Definition geometry.hpp:112
double y
Definition geometry.hpp:112
int y
Definition terrainerrorfield.cpp:60
double a
Definition terrainerrorfield.cpp:42
double b
Definition terrainerrorfield.cpp:42
int x
Definition terrainerrorfield.cpp:60