17#ifndef DGL_GEOMETRY_HPP_INCLUDED
18#define DGL_GEOMETRY_HPP_INCLUDED
27template<
typename>
class Line;
28template<
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;
173 void setSize(const T& width, const T& height) 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;
346 void moveBy(const T& x, const T& y) noexcept;
368 Line<T>& operator=(const
Line<T>& line) noexcept;
369 bool operator==(const
Line<T>& line) const noexcept;
370 bool operator!=(const
Line<T>& line) const noexcept;
372 #ifdef DGL_ALLOW_DEPRECATED_METHODS
377 DAF_DEPRECATED_BY(
"draw(const GraphicsContext&)")
407 Circle(const T& x, const T& y, const
float size, const uint numSegments = 300);
412 Circle(const
Point<T>& pos, const
float size, const uint numSegments = 300);
422 const T&
getX() const noexcept;
427 const T&
getY() const noexcept;
437 void setX(const T& x) noexcept;
442 void setY(const T& y) noexcept;
447 void setPos(const T& x, const T& y) noexcept;
487 bool operator==(const
Circle<T>& cir) const noexcept;
488 bool operator!=(const
Circle<T>& cir) const noexcept;
490 #ifdef DGL_ALLOW_DEPRECATED_METHODS
495 DAF_DEPRECATED_BY(
"draw(const GraphicsContext&)")
502 DAF_DEPRECATED_BY(
"drawOutline(const GraphicsContext&)")
512 float fTheta, fCos, fSin;
534 Triangle(const T& x1, const T& y1, const T& x2, const T& y2, const T& x3, const T& y3) noexcept;
580 bool operator==(const
Triangle<T>& tri) const noexcept;
581 bool operator!=(const
Triangle<T>& tri) const noexcept;
583 #ifdef DGL_ALLOW_DEPRECATED_METHODS
588 DAF_DEPRECATED_BY(
"draw(const GraphicsContext&)")
595 DAF_DEPRECATED_BY(
"drawOutline(const GraphicsContext&)")
622 Rectangle(const T& x, const T& y, const T& width, const T& height) noexcept;
647 const T&
getX() const noexcept;
652 const T&
getY() const noexcept;
677 void setX(const T& x) noexcept;
682 void setY(const T& y) noexcept;
687 void setPos(const T& x, const T& y) noexcept;
697 void moveBy(const T& x, const T& y) noexcept;
717 void setSize(const T& width, const T& height) noexcept;
747 bool contains(const T& x, const T& y) const noexcept;
762 template<typename T2>
809 Rectangle<T>& operator*=(
double m) noexcept;
810 Rectangle<T>& operator/=(
double d) noexcept;
811 bool operator==(const
Rectangle<T>& size) const noexcept;
812 bool operator!=(const
Rectangle<T>& size) const noexcept;
814 #ifdef DGL_ALLOW_DEPRECATED_METHODS
819 DAF_DEPRECATED_BY(
"draw(const GraphicsContext&)")
826 DAF_DEPRECATED_BY(
"drawOutline(const GraphicsContext&)")
Definition Geometry.hpp:397
void setSize(const float size) noexcept
void setY(const T &y) noexcept
void setPos(const T &x, const T &y) noexcept
void draw(const GraphicsContext &context)
void setNumSegments(const uint num)
uint getNumSegments() const noexcept
const T & getX() const noexcept
float getSize() const noexcept
const Point< T > & getPos() const noexcept
void drawOutline(const GraphicsContext &context, T lineWidth=1)
const T & getY() const noexcept
void setX(const T &x) noexcept
Definition Geometry.hpp:241
const T & getStartY() const noexcept
void setEndY(const T &y) noexcept
const T & getStartX() const noexcept
void setEndX(const T &x) noexcept
const T & getEndY() const noexcept
void moveBy(const T &x, const T &y) noexcept
const T & getEndX() const noexcept
const Point< T > & getEndPos() const noexcept
void setStartPos(const T &x, const T &y) noexcept
bool isNull() const noexcept
bool isNotNull() const noexcept
void setStartX(const T &x) noexcept
const Point< T > & getStartPos() const noexcept
void setStartY(const T &y) noexcept
void setEndPos(const T &x, const T &y) noexcept
void draw(const GraphicsContext &context, T width=1)
Definition Geometry.hpp:41
void setX(const T &x) noexcept
const T & getY() const noexcept
void moveBy(const T &x, const T &y) noexcept
const T & getX() const noexcept
bool isZero() const noexcept
void setY(const T &y) noexcept
void setPos(const T &x, const T &y) noexcept
bool isNotZero() const noexcept
Definition Geometry.hpp:612
void moveBy(const T &x, const T &y) noexcept
void growBy(double multiplier) noexcept
bool contains(const T &x, const T &y) const noexcept
const T & getX() const noexcept
const Size< T > & getSize() const noexcept
void shrinkBy(double divider) noexcept
void setRectangle(const Point< T > &pos, const Size< T > &size) noexcept
void draw(const GraphicsContext &context)
bool isValid() const noexcept
bool containsY(const T &y) const noexcept
bool isNotNull() const noexcept
const T & getY() const noexcept
bool isInvalid() const noexcept
void setPos(const T &x, const T &y) noexcept
const T & getHeight() const noexcept
void setHeight(const T &height) noexcept
void setSize(const T &width, const T &height) noexcept
bool containsX(const T &x) const noexcept
void setWidth(const T &width) noexcept
bool containsAfterScaling(const Point< T > &pos, double scaling) const noexcept
const T & getWidth() const noexcept
void drawOutline(const GraphicsContext &context, T lineWidth=1)
void setY(const T &y) noexcept
const Point< T > & getPos() const noexcept
bool isNull() const noexcept
void setX(const T &x) noexcept
Definition Geometry.hpp:133
bool isValid() const noexcept
void setHeight(const T &height) noexcept
bool isNotNull() const noexcept
const T & getWidth() const noexcept
void setSize(const T &width, const T &height) noexcept
void setWidth(const T &width) noexcept
bool isNull() const noexcept
bool isInvalid() const noexcept
void shrinkBy(double divider) noexcept
void growBy(double multiplier) noexcept
const T & getHeight() const noexcept
Definition Geometry.hpp:524
bool isNull() const noexcept
void drawOutline(const GraphicsContext &context, T lineWidth=1)
void draw(const GraphicsContext &context)
bool isValid() const noexcept
bool isInvalid() const noexcept
bool isNotNull() const noexcept