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;
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;
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;
272 const T& getStartX()
const noexcept;
277 const T& getStartY()
const noexcept;
282 const T& getEndX()
const noexcept;
287 const T& getEndY()
const noexcept;
292 const Point<T>& getStartPos()
const noexcept;
297 const Point<T>& getEndPos()
const noexcept;
302 void setStartX(
const T& x) noexcept;
307 void setStartY(
const T& y) noexcept;
312 void setStartPos(
const T& x,
const T& y) noexcept;
317 void setStartPos(
const Point<T>& pos) 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;
337 void setEndPos(
const Point<T>& pos) noexcept;
342 void moveBy(
const T& x,
const T& y) noexcept;
357 bool isNull()
const noexcept;
362 bool isNotNull()
const noexcept;
365 bool operator==(
const Line<T>& line)
const noexcept;
366 bool operator!=(
const Line<T>& line)
const noexcept;
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);
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;
444 float getSize()
const noexcept;
450 void setSize(
const float size) noexcept;
455 uint getNumSegments()
const noexcept;
461 void setNumSegments(
const uint num);
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;
533 bool isNull()
const noexcept;
539 bool isNotNull()
const noexcept;
544 bool isValid()
const noexcept;
550 bool isInvalid()
const noexcept;
553 bool operator==(
const Triangle<T>& tri)
const noexcept;
554 bool operator!=(
const Triangle<T>& tri)
const noexcept;
559 void _draw(
const bool outline);
581 Rectangle(
const T& x,
const T& y,
const T& width,
const T& height) 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;
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;
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;
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 void setX(const T &x) noexcept
Definition: Geometry.hpp:27
const T & getY() const noexcept
const T & getX() const noexcept
Definition: Geometry.hpp:40
Definition: Geometry.hpp:132
Definition: Geometry.hpp:30
void setPos(const T &x, const T &y) noexcept
Definition: Geometry.hpp:28
Definition: Geometry.hpp:29
void moveBy(const T &x, const T &y) noexcept
void setY(const T &y) noexcept
bool isNotZero() const noexcept
bool isZero() const noexcept