From 9b07407593412629a887e3cfc5c53b471b910d59 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Fri, 15 Jan 2016 13:54:31 +0100 Subject: 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) --- geometry.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'geometry.cpp') 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(); -- cgit v1.2.3