Skip to content

Commit

Permalink
Optimize Path Rendering Speed
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAugust12 committed Nov 26, 2023
1 parent de10c11 commit 1d6ce48
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) *
Expand All @@ -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) {
Expand Down

0 comments on commit 1d6ce48

Please sign in to comment.