convenience getter added

This commit is contained in:
Uwe Rathmann 2024-07-17 15:36:45 +02:00
parent 1aaf4ec296
commit 36ac8d95d6

View File

@ -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;
};