gnuastro-devel
[Top][All Lists]
Advanced

[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: Sat, 28 Mar 2020 16:53:10 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:74.0) Gecko/20100101 Firefox/74.0

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

Thanks, this explains it ;-).

I agree! We can mention in the documentation of
`gal_polygon_iscounterclockwise' that it currently doesn't differentiate
between a complex and simple polygon, and will just return the orientation
that occurs the most (by area). In fact, now that I think more about it, it is
reasonable.

We should later implement the Shamos-Hoey Algorithm and maybe call it
`gal_polygon_issimple'. 

By the way, it would be better if you rename all the `_is' functions with the
`is' part separated, for example `gal_polygon_is_counterclockwise' and
`gal_polygon_is_simple'.

In summary, I agree with your suggestion ;-). For now, we won't check for
simple/complex, we'll just focus on the orientation (which is incidentally
also the title of this task). 

You'll just need to make a change to the `gal_polygon_is_counterclockwise'
remove the case that returns a `GAL_POLYGON_ORIENTATION_COMPLEX' value, and
mention (in the documentation) that when the weight of the orientations is
equal, it will just return a counter-clockwise code. Infact, now it doesn't
need any macros any more, the return value is just `1' if its
counter-clockwise and 0 if its clockwise.

So can you just check some polygons that are given fully in counter-clockwise
(and keep the checks in `tests/during-dev.sh'), implement these corrections
and commit it so I try it out ;-)?

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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