Skip to content

Commit

Permalink
Tweaked the Path2d::spiral to get rid of a wobble.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhoux committed Jan 3, 2024
1 parent 0a0e895 commit 8b71336
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cinder/Path2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,15 +689,15 @@ Path2d Path2d::spiral( const vec2 &center, float innerRadius, float outerRadius,
Path2d shape;
shape.moveTo( center.x + p0.x * step, center.y + p0.y * step );

float radians = radiansStart + glm::radians( clamp( radiansStart * step, 3.0f, 90.0f ) ); // Adaptive step size.
float radians = radiansStart + glm::radians( clamp( radiansStart * step, 3.0f, 60.0f ) ); // Adaptive step size.
while( radians < radiansEnd ) {
const auto p3 = Point( radians, offset - radiansStart );
const auto controls = p3.generate( p0 );
shape.curveTo( center.x + controls.first.x * step, center.y + controls.first.y * step, center.x + controls.second.x * step, center.y + controls.second.y * step, center.x + p3.x * step, center.y + p3.y * step );

p0 = p3;

radians += glm::radians( glm::clamp( radians * step, 3.0f, 90.0f ) ); // Adaptive step size.
radians += glm::radians( glm::clamp( radians * step, 3.0f, 60.0f ) ); // Adaptive step size.
}

const auto p3 = Point( radiansEnd, offset - radiansStart );
Expand Down

0 comments on commit 8b71336

Please sign in to comment.