0

I have a polygon where I'm looking for 2 segments that are approximately 90 degree (+-20°). I always found the first one which is between p1 and p2 and I want to find p3, but in the image below, we can se that between p3 and p2 it's not a direct line.

enter image description here

I had thought maybe looking not directly the first point after p2 but a certain number of points and to see if it's still 90° between p1 p2 and that point but then I have the problem that it will not stop to the good p3. So I thought maybe a cost function calculated with the distance between p2 and the looking point and maybe the dot product, but it didn't turned out to be good.

Does someone maybe have an idea how could I just ignore the points between p3 and p2?

user3314570
  • 237
  • 4
  • 14
  • I take it that your input is a bitmap like the one you depicted, i.e. you don't know the order of points along the boundary up front? – MvG Jul 03 '14 at 09:32
  • yes. the order of the points is clockwise from the point on the up right corner (highest point). So I go from p2 to p3 – user3314570 Jul 03 '14 at 09:35
  • The approach in this [curve simplification algorithm](http://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm#Complexity) might be useful. The convex hull might also be useful, but it may not be suitable for some instances. – Nuclearman Jul 03 '14 at 14:17

1 Answers1

0

You could try to adapt the Hough transform to this application.

MvG
  • 57,380
  • 22
  • 148
  • 276