17 #ifndef DGL_GEOMETRY_HPP_INCLUDED
18 #define DGL_GEOMETRY_HPP_INCLUDED
27 template<
typename>
class Line;
28 template<
typename>
class Circle;
51 Point(const T& x, const T& y) noexcept;
61 const T&
getX() const noexcept;
66 const T&
getY() const noexcept;
71 void setX(const T& x) noexcept;
76 void setY(const T& y) noexcept;
81 void setPos(const T& x, const T& y) noexcept;
91 void moveBy(const T& x, const T& y) noexcept;
108 Point<T> operator+(const
Point<T>& pos) noexcept;
109 Point<T> operator-(const
Point<T>& pos) noexcept;
110 Point<T>& operator=(const
Point<T>& pos) noexcept;
111 Point<T>& operator+=(const
Point<T>& pos) noexcept;
112 Point<T>& operator-=(const
Point<T>& pos) noexcept;
113 bool operator==(const
Point<T>& pos) const noexcept;
114 bool operator!=(const
Point<T>& pos) const noexcept;
118 template<typename> friend class
Line;
119 template<typename> friend class
Circle;
120 template<typename> friend class
Triangle;
121 template<typename> friend class
Rectangle;
143 Size(const T& width, const T& height) noexcept;
153 const T& getWidth() const noexcept;
158 const T& getHeight() const noexcept;
163 void setWidth(const T& width) noexcept;
168 void setHeight(const T& height) noexcept;
173 void setSize(const T& width, const T& height) noexcept;
178 void setSize(const
Size<T>& size) noexcept;
183 void growBy(
double multiplier) noexcept;
188 void shrinkBy(
double divider) noexcept;
194 bool isNull() const noexcept;
200 bool isNotNull() const noexcept;
205 bool isValid() const noexcept;
211 bool isInvalid() const noexcept;
213 Size<
int> toInt() const noexcept;
215 Size<T> operator+(const
Size<T>& size) noexcept;
216 Size<T> operator-(const
Size<T>& size) noexcept;
217 Size<T>& operator=(const
Size<T>& size) noexcept;
218 Size<T>& operator+=(const
Size<T>& size) noexcept;
219 Size<T>& operator-=(const
Size<T>& size) noexcept;
220 Size<T>& operator*=(
double m) noexcept;
221 Size<T>& operator/=(
double d) noexcept;
222 Size<T> operator*(
double m) const noexcept;
223 Size<T> operator/(
double m) const noexcept;
224 bool operator==(const
Size<T>& size) const noexcept;
225 bool operator!=(const
Size<T>& size) const noexcept;
229 template<typename> friend class
Rectangle;
251 Line(const T& startX, const T& startY, const T& endX, const T& endY) noexcept;
256 Line(const T& startX, const T& startY, const
Point<T>& endPos) noexcept;
261 Line(const
Point<T>& startPos, const T& endX, const T& endY) noexcept;
276 const T& getStartX() const noexcept;
281 const T& getStartY() const noexcept;
286 const T& getEndX() const noexcept;
291 const T& getEndY() const noexcept;
296 const
Point<T>& getStartPos() const noexcept;
301 const
Point<T>& getEndPos() const noexcept;
306 void setStartX(const T& x) noexcept;
311 void setStartY(const T& y) noexcept;
316 void setStartPos(const T& x, const T& y) noexcept;
321 void setStartPos(const
Point<T>& pos) noexcept;
326 void setEndX(const T& x) noexcept;
331 void setEndY(const T& y) noexcept;
336 void setEndPos(const T& x, const T& y) noexcept;
341 void setEndPos(const
Point<T>& pos) noexcept;
346 void moveBy(const T& x, const T& y) noexcept;
356 bool isNull() const noexcept;
361 bool isNotNull() const noexcept;
363 #ifndef DPF_TEST_POINT_CPP
371 bool operator==(
const Line<T>& line)
const noexcept;
372 bool operator!=(
const Line<T>& line)
const noexcept;
374 #ifndef DPF_TEST_POINT_CPP
379 DISTRHO_DEPRECATED_BY(
"draw(const GraphicsContext&)")
409 Circle(const T& x, const T& y, const
float size, const uint numSegments = 300);
414 Circle(const
Point<T>& pos, const
float size, const uint numSegments = 300);
424 const T&
getX() const noexcept;
429 const T&
getY() const noexcept;
434 const
Point<T>& getPos() const noexcept;
439 void setX(const T& x) noexcept;
444 void setY(const T& y) noexcept;
449 void setPos(const T& x, const T& y) noexcept;
459 float getSize() const noexcept;
465 void setSize(const
float size) noexcept;
470 uint getNumSegments() const noexcept;
476 void setNumSegments(const uint num);
489 bool operator==(const
Circle<T>& cir) const noexcept;
490 bool operator!=(const
Circle<T>& cir) const noexcept;
492 #ifndef DPF_TEST_POINT_CPP
497 DISTRHO_DEPRECATED_BY(
"draw(const GraphicsContext&)")
514 float fTheta, fCos, fSin;
536 Triangle(const T& x1, const T& y1, const T& x2, const T& y2, const T& x3, const T& y3) noexcept;
552 bool isNull() const noexcept;
558 bool isNotNull() const noexcept;
563 bool isValid() const noexcept;
569 bool isInvalid() const noexcept;
582 bool operator==(const
Triangle<T>& tri) const noexcept;
583 bool operator!=(const
Triangle<T>& tri) const noexcept;
585 #ifndef DPF_TEST_POINT_CPP
590 DISTRHO_DEPRECATED_BY(
"draw(const GraphicsContext&)")
624 Rectangle(const T& x, const T& y, const T& width, const T& height) noexcept;
649 const T&
getX() const noexcept;
654 const T&
getY() const noexcept;
659 const T& getWidth() const noexcept;
664 const T& getHeight() const noexcept;
669 const
Point<T>& getPos() const noexcept;
674 const
Size<T>& getSize() const noexcept;
679 void setX(const T& x) noexcept;
684 void setY(const T& y) noexcept;
689 void setPos(const T& x, const T& y) noexcept;
699 void moveBy(const T& x, const T& y) noexcept;
709 void setWidth(const T& width) noexcept;
714 void setHeight(const T& height) noexcept;
719 void setSize(const T& width, const T& height) noexcept;
724 void setSize(const
Size<T>& size) noexcept;
729 void growBy(
double multiplier) noexcept;
734 void shrinkBy(
double divider) noexcept;
739 void setRectangle(const
Point<T>& pos, const
Size<T>& size) noexcept;
749 bool contains(const T& x, const T& y) const noexcept;
754 bool contains(const
Point<T>& pos) const noexcept;
759 bool containsAfterScaling(const
Point<T>& pos,
double scaling) const noexcept;
764 template<typename T2>
765 bool contains(const
Point<T2>& pos) const noexcept;
770 bool containsX(const T& x) const noexcept;
775 bool containsY(const T& y) const noexcept;
781 bool isNull() const noexcept;
787 bool isNotNull() const noexcept;
792 bool isValid() const noexcept;
798 bool isInvalid() const noexcept;
811 Rectangle<T>& operator*=(
double m) noexcept;
812 Rectangle<T>& operator/=(
double d) noexcept;
813 bool operator==(const
Rectangle<T>& size) const noexcept;
814 bool operator!=(const
Rectangle<T>& size) const noexcept;
Definition: Geometry.hpp:399
Definition: Geometry.hpp:241
void draw(const GraphicsContext &context, T width=1)
Definition: Geometry.hpp:41
void setX(const T &x) noexcept
void moveBy(const T &x, const T &y) noexcept
bool isZero() const noexcept
void setY(const T &y) noexcept
void setPos(const T &x, const T &y) noexcept
const T & getY() const noexcept
bool isNotZero() const noexcept
const T & getX() const noexcept
Definition: Geometry.hpp:614
Definition: Geometry.hpp:133
Definition: Geometry.hpp:526