gnuastro-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[task #13658] Work on concave polygons too


From: Mohammad Akhlaghi
Subject: [task #13658] Work on concave polygons too
Date: Sat, 14 Mar 2020 22:35:26 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

Follow-up Comment #13, task #13658 (project gnuastro):

After the last post, and based on the taught that there is possibly no unique
concave polygon from a set of points. So I thought it is probably necessary to
add an option to avoid sorting and let the program use the same order that the
user provided.

I did that manually, but then noticed that even when we do solve the sorting
problem, we will have another problem: the function `gal_polygon_pin' (which
is used to see if a point is within a polygon) also implicitly assumes a
convex polygon. Best said by the function's comment: "If the point is inside
the polygon, it will always be to the left of the edge connecting the two
vertices when the vertices are traversed in order."

I had a fast search and found this StackOverflow question
<https://stackoverflow.com/questions/217578> on the subject with an apparently
good (and very well explained!) answer. 

Of course, this doesn't mean that we should not sort the vertices! That is
indeed important in a generic scenario (where we can't assume that they are
sorted). I just want to say that after the sorting of vertices is done, we
also need to write a generic point-in-polygon function that can be used for
concave polygons too.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/task/?13658>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]