Polygon CCW winding check request
Francois-Xavier PINEAU
francois-xavier.pineau at astro.unistra.fr
Fri Jun 15 09:34:03 CEST 2018
Le 14/06/2018 à 18:22, Arnold Rots a écrit :
> The downside is that this only applies to spherical celestial
> coordinate systems.
You are right, my mistake. I should have talked about the z-axis
unit-point (i.e. the point of coordinate (0, 0, 1)).
Said differently to be more generic:
the z-axis unit point is in the inside area of the polygon if it is on
the left (or a better term to say (v1 x v2) . z > 0) of the first edge
whose support plane is not coplanar with the z-axis.
(it is only an example of possible convention)
The x-axis correspond to (lon, lat) = (0, 0)
The y-axis correspond to (lon, lat) = (pi/2, 0)
The z-axis correspond to (lon, lat) = (0, pi/2)
We suppose that we always use the right-hand rule.
> And I maintain that it is a very bad idea to allow self-intersecting
> polygons.
Sorry, but I am not sure to understand why.
If we let a user the possibility to draw a polygon by hand on the
sphere, why forbidding self-crossing polygons?
E.g. in the TOPCAT 2D-plot, you are allowed to draw self-crossing regions.
Both as a TOPCAT user and as an implementor, I think this is the easier
way to go in an application.
> the halfspaces used by the SDSS people provide a perfect and
unambiguous way to specify any shape, with the exception of ellipses.
And the exception of HEALPix cells, and ...
François-Xavier
>
> - Arnold
>
> -------------------------------------------------------------------------------------------------------------
> Arnold H. Rots Chandra X-ray Science Center
> Smithsonian Astrophysical Observatory tel: +1 617 496 7701
> 60 Garden Street, MS 67 fax: +1 617 495 7356
> Cambridge, MA 02138 arots at cfa.harvard.edu <mailto:arots at cfa.harvard.edu>
> USA http://hea-www.harvard.edu/~arots/
> <http://hea-www.harvard.edu/%7Earots/>
> --------------------------------------------------------------------------------------------------------------
>
>
> On Thu, Jun 14, 2018 at 9:13 AM, Francois-Xavier PINEAU
> <francois-xavier.pineau at astro.unistra.fr
> <mailto:francois-xavier.pineau at astro.unistra.fr>> wrote:
>
>
> Le 13/06/2018 à 23:58, Markus Nullmeier a écrit :
>
> Hello list,
>
> On 13/06/18 10:05, Francois-Xavier PINEAU wrote:
>
> Example: if we take the case of a simple 4 vertices's
> polygon having a
> butterfly shape (i.e. having two crossing great-circle
> arcs), then the
> inside of one "wing" is in the counter-clockwise sense
> while the inside
> of the other "wing" is in the clockwise sense.
>
> Well, a definition that allows polygon edges to intersect would be
> unsound, probably in several ways. One of them is the mentioned
> inability to describe the complement of a polygon as a single
> polygon.
>
> Ok, a polygon (defined by a list of successive vertices) defines
> two complementary areas on the unit sphere.
> To know which one is considered as being inside the polygon, why
> not taking a reference point like the North pole (N):
>
> If N is on the left side of the first great-arc of the polygon
> (mathematically, if ((vertex1 cross_product vertex2)
> scalar_product north pole) > 0), then N is in the area considered
> as being inside the polygon, else it is in the outside area.
>
>
> I see one possible complication:
> if N is a vertex or on an edge of the polygon, then:
> - the first edge must not contain N
> - if N is considered as inside: the inside is defined by the
> area(s) on the left part of the edge(s) containing N
> - if N is considered as outside: the inside is the complement of
> the area considering N inside
>
> This simple definition is able to deal with both simple and
> self-intersecting polygons.
>
> In attachment, 3 large polygons (2 self intersecting, and one
> having a surface area > 2*pi): I adapted the following 10 lines of
> code (in 2d) to the spherical case
> (https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html
> <https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html>).
>
> Kind regards,
>
>
> François-Xavier
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ivoa.net/pipermail/dm/attachments/20180615/4001aba9/attachment.html>
More information about the dm
mailing list