title: How to group or cluster polar coordinate system data in python
body: <p>I have an RPLidar and my task is to detect an obstacle. From the sensor, I am getting a set of truples which contains the quality of signal, angle and distance in mm. </p>
  
  <p>Here are the example: </p>
  
  <pre><code>[(15, 1.375, 2569.0), (15, 3.0, 2491.5), (15, 4.578125, 2528.75), (15, 6.203125, 2419.75), (15, 7.796875, 2299.75), (15, 9.40625, 2200.5), (15, 11.078125, 2104.25), (15, 12.703125, 2047.25), (15, 14.3125, 2091.75), (15, 15.84375, 2132.25), (15, 17.46875, 2183.75), (15, 19.015625, 2232.5), (15, 20.609375, 2288.75), (15, 22.15625, 2341.0), (15, 23.765625, 2411.0), (15, 25.34375, 2481.0), (15, 26.875, 2554.25), (15, 28.453125, 2641.0), (15, 30.046875, 2731.5), (15, 31.609375, 2824.0), (15, 33.1875, 2854.75), (11, 39.8125, 2178.0), (15, 41.390625, 2278.0), (15, 42.984375, 2199.5), (13, 44.546875, 2269.0), (15, 46.171875, 2265.5), (15, 47.71875, 2300.75), (15, 49.3125, 2454.25), (15, 50.890625, 2442.0), (15, 52.484375, 2415.0), (15, 54.109375, 2404.0), (15, 55.703125, 2390.0), (15, 57.28125, 2371.0), (15, 58.796875, 2357.5), (15, 60.421875, 2348.5), (15, 61.984375, 2344.0), (15, 63.5625, 2340.5), (15, 65.171875, 2332.75), (15, 66.75, 2328.25), (15, 68.34375, 2330.75), (15, 69.984375, 2324.5), (15, 71.515625, 2328.25), (15, 73.125, 2332.75), (15, 74.71875, 2335.75), (15, 76.28125, 2341.5)]
  </code></pre>
  
  <p>I have plot those data in a matplotlib and that is how they look like: </p>
  
  <p><a href="https://i.stack.imgur.com/sMIZe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sMIZe.png" alt="![enter image description here"></a></p>
  
  <p>As you can see i am getting the surroundings information as point and each point has quality,angle,distance from the center. Now i want to group them and need to find the length of the each group. how can i achive this? is there any library available in python by which i can do the clustering like as bellow?<a href="https://i.stack.imgur.com/Sfiw2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sfiw2.png" alt="enter image description here"></a> </p>