algorithm - Trace a shape into a polygon of max n sides -


I am looking for an algorithm that will get an irregular shape, probably not random, such as the crushing cycle Detects a polygon of maximum N sides around the surface, and around the shape. 'N' can be based on the area of ​​maximimum size.

"itemprop =" text ">

I will do it like this

  1. ang touch and dang for all curve segments, measure tangent angles

    For this you or atan2 Can use

      ang [i] = accent (x [i] -x [i-1], y [i] -y [i-1]); Dang [I] = Ang [Ii] -ang [I-1];  Dang    
  2. Find Invex Point (Black)

    Code> is changing at these points Then

      Dang [i-1] * Dang [i + 1] is & lt; 0.0   

    but you need to handle the code> dang = 0.0 element properly (before and after it needs to be scanned).

  3. Add maximum number (green) to these points

    This point will be a fundamental skeleton for your point Tangent angle is among the closest differences, in order to find the maximum point between the index number i0 and i1 the nearest angle to angavg Find = 0.5 * (ang [i0] + ang [i1])

    Do not forget that

      | Ang [i] -gang & Lt; = PI   

    then +/- 2.0 * PI if this is not true

  4. Now You should have all the important points of your closed polycurve ...

    It should look like this:

     img

    CW / CCW or red / blue bus dang [ii] ... [Notes]

    The output point type must be protected (Inks / MaxPoint) because it is used to compare and detect the shapes later on. A used ...

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -