From 0f34fd437efb936ef29ac91186321aa7251fbfb1 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Tue, 23 May 2023 11:22:33 +0200 Subject: Massive changes in initial port away from Qt. --- geometry.h | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'geometry.h') diff --git a/geometry.h b/geometry.h index eb4e05d..200782c 100644 --- a/geometry.h +++ b/geometry.h @@ -1,17 +1,58 @@ #ifndef GEOMETRY_H #define GEOMETRY_H -#include +class Point2D +{ +public: + Point2D(); + + void set(float, float); + float x() const { return m_x; } + float y() const { return m_y; } + +private: + float m_x, m_y; +}; + +class RectF +{ +public: + RectF(float, float, float, float); + RectF(const RectF &); + RectF(const Point2D &, const Point2D &); + + float x() const { return m_x; } + float y() const { return m_y; } + float width() const { return m_width; } + float height() const { return m_height; } + + bool contains(float x, float y) const; + bool intersects(const RectF &) const; + +private: + float m_x, m_y, m_width, m_height; +}; + +class Geometry +{ +public: + Geometry(); + + int vertexCount() const; + Point2D *vertexDataAsPoint2D(); + +private: +}; // Circle int calculateCircleVertexCount(float radius); -void updateCircleGeometry(QSGGeometry *geometry, float radius, float cx, float cy); +void updateCircleGeometry(Geometry *geometry, float radius, float cx, float cy); // Rect -void updateRectGeometry(QSGGeometry *geometry, float x, float y, float w, float h); +void updateRectGeometry(Geometry *geometry, float x, float y, float w, float h); // Crosshair -void updateCrossHairGeometry(QSGGeometry *geometry, +void updateCrossHairGeometry(Geometry *geometry, float x, float y, float thickness, -- cgit v1.2.3