diff options
author | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-15 13:54:31 +0100 |
---|---|---|
committer | Samuel Fadel <samuelfadel@gmail.com> | 2016-01-15 13:54:31 +0100 |
commit | 9b07407593412629a887e3cfc5c53b471b910d59 (patch) | |
tree | d00a4f9949a1b687cb3e7564041630c20cdb33da /geometry.cpp | |
parent | 3a025908b2bd3b8d25b228ec14ad41b111ed21c8 (diff) |
Scatterplot: visual update.
* Selection is now indicated with outline (black for selected
points; white otherwise)
* Circle geometry now takes diameter as input (more related to
glyph size)
Diffstat (limited to 'geometry.cpp')
-rw-r--r-- | geometry.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/geometry.cpp b/geometry.cpp index 3a4a861..4ed01ee 100644 --- a/geometry.cpp +++ b/geometry.cpp @@ -2,20 +2,20 @@ static const float PI = 3.1415f; -int calculateCircleVertexCount(float radius) +int calculateCircleVertexCount(float diameter) { // 10 * sqrt(r) \approx 2*pi / acos(1 - 1 / (4*r)) - return int(10.0 * sqrt(radius)); + return int(10.0 * sqrt(diameter / 2)); } -void updateCircleGeometry(QSGGeometry *geometry, float radius, float cx, float cy) +void updateCircleGeometry(QSGGeometry *geometry, float diameter, float cx, float cy) { int vertexCount = geometry->vertexCount(); float theta = 2 * PI / float(vertexCount); float c = cosf(theta); float s = sinf(theta); - float x = radius; + float x = diameter / 2; float y = 0; QSGGeometry::Point2D *vertexData = geometry->vertexDataAsPoint2D(); |