I have paths in SVG file with d attributes with values like

M 48.75521890547264 45.77014427860697 Q 48.756218905472636 45.77114427860697 50.24875621890547 45.77114427860697 Q 51.74129353233831 45.77114427860697 55.72139303482587 46.26865671641791 Q 59.701492537313435 46.766169154228855 64.17910447761194 46.766169154228855 Q 68.65671641791045 46.766169154228855 73.6318407960199 47.2636815920398 Q 78.60696517412936 47.76119402985075 82.08955223880596 47.76119402985075 Q 85.57213930348259 47.76119402985075 88.55721393034827


I want to classify this path into geometric shapes like circle, rectangle, ellipse etc programmatically. When I say programmatically I mean no image processing techniques should be involved i.e. strict requirement.
Is there any way to do this. Please guide me.

  • $\begingroup$ You might find the discussion, code and links at svgo's issue #65 relevant. $\endgroup$
    – waldyrious
    Dec 29, 2019 at 9:06
  • $\begingroup$ This is in fact a bit error prone. I do some amount of cnc work and due to the controller of some machines it would be great to identify circles and circle segments. But the thing is to identify circles well the software needs to be quite agressive at detecting them. Which is bad because it kills the carefully constructed C2 continious fillets of some users. The problem being that a bezier is never a circle so there is allways some guesswork involved especially since there are many ways to approximate a circle. $\endgroup$
    – joojaa
    Dec 29, 2019 at 14:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.