17 #ifndef DGL_GEOMETRY_HPP_INCLUDED
18 #define DGL_GEOMETRY_HPP_INCLUDED
27 template<
typename>
class Line;
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;
101 bool isZero()
const 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;
163 void setWidth(
const T& width) noexcept;
168 void setHeight(
const T& height) noexcept;
173 void setSize(
const T& width,
const T& height) noexcept;
183 void growBy(
double multiplier) noexcept;
188 void shrinkBy(
double divider) noexcept;
194 bool isNull()
const noexcept;
218 Size<T>& operator*=(
double m) noexcept;
219 Size<T>& operator/=(
double d) noexcept;
220 bool operator==(
const Size<T>& size)
const noexcept;
221 bool operator!=(
const Size<T>& size)
const noexcept;
225 template<
typename>
friend class Rectangle;
247 Line(const T& startX, const T& startY, const T& endX, const T& endY) noexcept;
252 Line(const T& startX, const T& startY, const
Point<T>& endPos) noexcept;
257 Line(const
Point<T>& startPos, const T& endX, const T& endY) noexcept;
282 const T&
getEndX() const noexcept;
287 const T&
getEndY() const noexcept;
322 void setEndX(const T& x) noexcept;
327 void setEndY(const T& y) noexcept;
332 void setEndPos(const T& x, const T& y) noexcept;
342 void moveBy(const T& x, const T& y) noexcept;
357 bool isNull() const noexcept;
364 Line<T>& operator=(const
Line<T>& line) noexcept;
365 bool operator==(const
Line<T>& line) const noexcept;
366 bool operator!=(const
Line<T>& line) const noexcept;
369 Point<T> fPosStart, fPosEnd;
394 Circle(const T& x, const T& y, const
float size, const uint numSegments = 300);
399 Circle(const
Point<T>& pos, const
float size, const uint numSegments = 300);
404 Circle(const Circle<T>& cir) noexcept;
409 const T& getX() const noexcept;
414 const T& getY() const noexcept;
419 const
Point<T>& getPos() const noexcept;
424 void setX(const T& x) noexcept;
429 void setY(const T& y) noexcept;
434 void setPos(const T& x, const T& y) noexcept;
439 void setPos(const
Point<T>& pos) noexcept;
444 float getSize() const noexcept;
450 void setSize(const
float size) noexcept;
455 uint getNumSegments() const noexcept;
461 void setNumSegments(const uint num);
473 Circle<T>& operator=(const Circle<T>& cir) noexcept;
474 bool operator==(const Circle<T>& cir) const noexcept;
475 bool operator!=(const Circle<T>& cir) const noexcept;
483 float fTheta, fCos, fSin;
485 void _draw(const
bool outline);
507 Triangle(const T& x1, const T& y1, const T& x2, const T& y2, const T& x3, const T& y3) noexcept;
512 Triangle(const
Point<T>& pos1, const
Point<T>& pos2, const
Point<T>& pos3) noexcept;
517 Triangle(const Triangle<T>& tri) noexcept;
533 bool isNull() const noexcept;
544 bool isValid() const noexcept;
550 bool isInvalid() const noexcept;
552 Triangle<T>& operator=(const Triangle<T>& tri) noexcept;
553 bool operator==(const Triangle<T>& tri) const noexcept;
554 bool operator!=(const Triangle<T>& tri) const noexcept;
557 Point<T> fPos1, fPos2, fPos3;
559 void _draw(const
bool outline);
576 Rectangle() noexcept;
581 Rectangle(const T& x, const T& y, const T& width, const T& height) noexcept;
586 Rectangle(const T& x, const T& y, const
Size<T>& size) noexcept;
591 Rectangle(const
Point<T>& pos, const T& width, const T& height) noexcept;
596 Rectangle(const
Point<T>& pos, const
Size<T>& size) noexcept;
601 Rectangle(const Rectangle<T>& rect) noexcept;
606 const T& getX() const noexcept;
611 const T& getY() const noexcept;
616 const T& getWidth() const noexcept;
621 const T& getHeight() const noexcept;
626 const
Point<T>& getPos() const noexcept;
631 const
Size<T>& getSize() const noexcept;
636 void setX(const T& x) noexcept;
641 void setY(const T& y) noexcept;
646 void setPos(const T& x, const T& y) noexcept;
651 void setPos(const
Point<T>& pos) noexcept;
656 void moveBy(const T& x, const T& y) noexcept;
666 void setWidth(const T& width) noexcept;
671 void setHeight(const T& height) noexcept;
676 void setSize(const T& width, const T& height) noexcept;
681 void setSize(const
Size<T>& size) noexcept;
686 void growBy(
double multiplier) noexcept;
691 void shrinkBy(
double divider) noexcept;
696 void setRectangle(const
Point<T>& pos, const
Size<T>& size) noexcept;
701 void setRectangle(const Rectangle<T>& rect) noexcept;
706 bool contains(const T& x, const T& y) const noexcept;
711 bool contains(const
Point<T>& pos) const noexcept;
716 bool containsX(const T& x) const noexcept;
721 bool containsY(const T& y) const noexcept;
733 Rectangle<T>& operator=(const Rectangle<T>& rect) noexcept;
734 Rectangle<T>& operator*=(
double m) noexcept;
735 Rectangle<T>& operator/=(
double d) noexcept;
736 bool operator==(const Rectangle<T>& size) const noexcept;
737 bool operator!=(const Rectangle<T>& size) const noexcept;
743 void _draw(const
bool outline);
750 #endif // DGL_GEOMETRY_HPP_INCLUDED
bool isNotNull() const noexcept
void moveBy(const T &x, const T &y) noexcept
void setX(const T &x) noexcept
const T & getStartX() const noexcept
Definition: Geometry.hpp:28
const T & getEndY() const noexcept
bool isValid() const noexcept
void setStartX(const T &x) noexcept
void setEndX(const T &x) noexcept
const T & getY() const noexcept
void shrinkBy(double divider) noexcept
const T & getX() const noexcept
Definition: Geometry.hpp:40
void setStartY(const T &y) noexcept
void setSize(const T &width, const T &height) noexcept
Definition: Geometry.hpp:132
const Point< T > & getStartPos() const noexcept
void setHeight(const T &height) noexcept
void setPos(const T &x, const T &y) noexcept
void setEndPos(const T &x, const T &y) noexcept
bool isNull() const noexcept
bool isInvalid() const noexcept
void moveBy(const T &x, const T &y) noexcept
Definition: Geometry.hpp:29
void setWidth(const T &width) noexcept
const T & getEndX() const noexcept
void setStartPos(const T &x, const T &y) noexcept
void growBy(double multiplier) noexcept
Definition: Geometry.hpp:30
void setEndY(const T &y) noexcept
Definition: Geometry.hpp:27
const T & getHeight() const noexcept
const T & getStartY() const noexcept
bool isNotNull() const noexcept
bool isNull() const noexcept
void setY(const T &y) noexcept
const Point< T > & getEndPos() const noexcept
bool isNotZero() const noexcept
bool isZero() const noexcept
const T & getWidth() const noexcept