aboutsummaryrefslogtreecommitdiff
path: root/geometry.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'geometry.cpp')
-rw-r--r--geometry.cpp8
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();