From 1d6ce4871f9d2cec32d9e37aa40fa2ededc03611 Mon Sep 17 00:00:00 2001 From: JonasAugust12 <111167499+JonasAugust12@users.noreply.github.com> Date: Sun, 26 Nov 2023 20:29:52 +0700 Subject: [PATCH] Optimize Path Rendering Speed --- src/Renderer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 09ee9f1a..098b9c16 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -401,7 +401,7 @@ namespace { std::vector< Vector2Df > curvePositions; int n = controlPoints.size() - 1; - for (float t = 0.0; t <= 1.0; t += 0.001) { + for (float t = 0.0; t <= 1.0; t += 0.01) { Vector2Df curvePos = {0.0, 0.0}; for (int i = 0; i <= n; ++i) { curvePos.x += computeBinomial(n, i) * pow((1 - t), (n - i)) * @@ -419,7 +419,7 @@ namespace { void Renderer::drawCurve(Curve curve) const { std::vector< Vector2Df > points = curve.getPoints(); std::vector< Vector2Df > curvePoints = BezierCurveVertices(points); - if (curvePoints.size() > 1) { + if (curvePoints.size() > 2) { Polyline p(curve.getFillColor(), curve.getOutlineColor(), curve.getOutlineThickness()); for (const auto& point : curvePoints) {