diff --git a/include/cinder/Path2d.h b/include/cinder/Path2d.h index 828c881566..5efb2cb601 100644 --- a/include/cinder/Path2d.h +++ b/include/cinder/Path2d.h @@ -222,9 +222,7 @@ class CI_API Path2d { private: void arcHelper( const vec2 ¢er, float radius, float startRadians, float endRadians, bool forward ); void arcSegmentAsCubicBezier( const vec2 ¢er, float radius, float startRadians, float endRadians ); - - float angleHelper( const vec2 &u, const vec2 &v ) const; - + //! Returns the minimum distance from point \a pt to segment \a segment. The \a firstPoint parameter can be used as an optimization if known, otherwise pass 0. float calcDistance( const vec2 &pt, size_t segment, size_t firstPoint ) const; diff --git a/src/cinder/Path2d.cpp b/src/cinder/Path2d.cpp index 83a1ff8a84..4f231db7ca 100644 --- a/src/cinder/Path2d.cpp +++ b/src/cinder/Path2d.cpp @@ -313,14 +313,6 @@ void Path2d::arcSegmentAsCubicBezier( const vec2 ¢er, float radius, float st center.y + r_sin_B - h * r_cos_B, center.x + r_cos_B, center.y + r_sin_B ); } -float Path2d::angleHelper( const vec2 &u, const vec2 &v ) const -{ - // See: equation 5.4 of https://www.w3.org/TR/SVG/implnote.html - const float c = u.x * v.y - u.y * v.x; - const float d = glm::dot( glm::normalize( u ), glm::normalize( v ) ); - return c < 0 ? -math::acos( d ) : math::acos( d ); -} - // Implementation courtesy of Lennart Kudling void Path2d::arcTo( const vec2 &p1, const vec2 &t, float radius ) { @@ -395,6 +387,18 @@ void Path2d::arcTo( const vec2 &p1, const vec2 &t, float radius ) } } +namespace { + +float angleHelper( const vec2 &u, const vec2 &v ) +{ + // See: equation 5.4 of https://www.w3.org/TR/SVG/implnote.html + const float c = u.x * v.y - u.y * v.x; + const float d = glm::dot( glm::normalize( u ), glm::normalize( v ) ); + return c < 0 ? -math::acos( d ) : math::acos( d ); +} + +} // namespace + void Path2d::arcTo( float rx, float ry, float phi, bool largeArcFlag, bool sweepFlag, const vec2 &p2 ) { // See: https://www.w3.org/TR/SVG/implnote.html