<p>I have paths in SVG file with <code>d</code> attributes with values like </p>

<blockquote>
  <p>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</p>
</blockquote>

<p>etc.</p>

<p>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.<br>
Is there any way to do this. Please guide me.  </p>

CC BY-SA 4.0
2019-12-29T09:06:45.543Z
You might find the discussion, code and links at [svgo's issue #65](https://github.com/svg/svgo/issues/65) relevant.
waldyrious
CC BY-SA 4.0
2019-12-29T14:39:43.440Z
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.
joojaa
<vector-graphics>
How to programmatically extract shape types like circle etc from SVG file path attributes
Papasani Mohansrinivas
# How to programmatically extract shape types like circle etc from SVG file path attributes

(Asked by: username_0 on 2019-12-28)

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

etc.

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.

**Tags:** vector-graphics

> **Comments:**
> **username_1**: You might find the discussion, code and links at [svgo's issue #65](https://github.com/svg/svgo/issues/65) relevant.  
> **username_2**: 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.  

---

## 0 answers

