From 36ac8d95d69a5276417f2bd2d72bafb205f28d65 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Wed, 17 Jul 2024 15:36:45 +0200 Subject: [PATCH] convenience getter added --- src/nodes/QskVertex.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/nodes/QskVertex.h b/src/nodes/QskVertex.h index 540d8ffe..528f9c17 100644 --- a/src/nodes/QskVertex.h +++ b/src/nodes/QskVertex.h @@ -128,11 +128,20 @@ namespace QskVertex inline void setLine( float x1, float y1, float x2, float y2, Color ) noexcept { /* The color parameter makes no sense, but is useful - when being using from templated code + when being used from templated code */ setLine( x1, y1, x2, y2 ); } + inline float x1() const noexcept { return p1.x; } + inline float y1() const noexcept { return p1.y; } + + inline float x2() const noexcept { return p2.x; } + inline float y2() const noexcept { return p2.y; } + + inline float dx() const noexcept { return p2.x - p1.x; } + inline float dy() const noexcept { return p2.y - p1.y; } + QSGGeometry::Point2D p1; QSGGeometry::Point2D p2; }; @@ -172,6 +181,15 @@ namespace QskVertex setLine( x, y1, color, x, y2, color ); } + inline float x1() const noexcept { return p1.x; } + inline float y1() const noexcept { return p1.y; } + + inline float x2() const noexcept { return p2.x; } + inline float y2() const noexcept { return p2.y; } + + inline float dx() const noexcept { return p2.x - p1.x; } + inline float dy() const noexcept { return p2.y - p1.y; } + QSGGeometry::ColoredPoint2D p1; QSGGeometry::ColoredPoint2D p2; };