[Top][All Lists]

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

[task #15578] Function to find if polygon vertices are sorted anti-clock

From: Mohammad Akhlaghi
Subject: [task #15578] Function to find if polygon vertices are sorted anti-clockwise
Date: Mon, 23 Mar 2020 20:00:30 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

Follow-up Comment #4, task #15578 (project gnuastro):

Thanks a lot Sachin, this is a very clean commit and I enjoyed reading the
`git log -1 -p' :-).

But as I read more into it I recognized that this is only one part of this
task's aim: finding if the *ordered* set of points are clock-wise or counter

Before that, we should make sure if the polygon is indeed ordered or not. For
example say I have the simple polygon of (0,0), (0,1), (1,1) and (1,0) which
is ordered counter-clockwise. But what if the user gives the points like this:
(0,0), (1,1), (1,0) and (0,1). We need a function to see if the given set of
points is already sorted or not (to possibly pass onto the sorting algorithm
and avoid sorting if its not necessary (especially since there isn't a unique
sort for concave polygons).

However, this function (and its nice documentation!) is part of the job and is
ready. So I can merge it, but it would just be good if you correct its name to
something like `gal_polygon_iscounterclockwise': it can return 1 if the
ordered set has a counterclockwise direction and 0 if it is clockwise. What do
you think? If you agree, make the corrections and I'll merge this part for


Reply to this item at:


  Message sent via Savannah

reply via email to

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