WD-DALI-1.1 polygon winding direction

Arnold Rots arots at cfa.harvard.edu
Thu Sep 8 20:34:38 CEST 2016


Here is the polygon section from STC.
It is explicit about polygons being sequenced CCW.
However, beware of the handedness of coordinate systems!
I note that the sign for the spherical expression seems wrong and that the
comment about flipping the sign for right-handed systems is clearly a
mistake.

  - Arnold

A Polygon (2-dimensional) is an ordered list of one or more vertices. Its
area is defined as that contained within (i.e., to the left of) the lines
connecting neighboring (that is, in the ordered list) vertices. If the
CoordFlavor is CARTESIAN, these lines are truly lines. The last vertex in
the list connects back to the first.

If the CoordFlavor is SPHERICAL, the lines are, by default, great-circles,
unless the Vertex object contains a SmallCircle object; in that case the
line connecting that vertex with its predecessor is a small-circle
(parallel). The curvature of the parallel is determined by the pole of the
SpatialFrame in the current AstroCoordSystem, unless a PolePosition is
explicitly specified in the Vertex object. It is the responsibility of the
server to ensure that the positions of the two sequential vertices actually
lie on a parallel that is consistent with the implied or specified pole. In
order to avoid ambiguities in direction, vertices need to be less than 180°
apart in both coordinates. Great circles or small circles spanning 180°
require specification of an extra intermediate vertex.

The area *A* of a polygon with *n* vertices *x* in Cartesian space may be
calculated as:

A = 0.5 * Sum(| *x**i* *x**i+1* |
*)*

The summation is over determinants of matrices formed by the position
vectors *x**i* of successive vertices; *x**n+1* = *x**1*. In spherical
space (left-handed coordinates) the area is:

A = -Sum(alpha(i)) - (n-2)*pi

alpha(i) are the polygon’s angles at the vertices. Reverse the sign for
right-handed coordinates. If the coordinate system is defined on the
surface of a body (rather than the celestial or unit sphere), one should
multiply by the square of the radius.

The boundaries are considered part of the region. The inside of the region
is defined as that part of coordinate space that is encircled by the
polygon in a counter-clockwise sense. What this means is that, in a plane,
if *A* > 0, the “inside” of the polygon is included; if *A* < 0, the
“outside” is selected. On a sphere with a left-handed (celestial)
coordinate system, if *A* > 0, one has identified the inside of the
polygon; if *A* < 0, one used the “outside” angles of the polygon and the
area is really* 4pi - A *. Note that the negation operation is a simple
matter of reversing the order of the vertex list.


-------------------------------------------------------------------------------------------------------------
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
USA
http://hea-www.harvard.edu/~arots/
--------------------------------------------------------------------------------------------------------------


On Thu, Sep 8, 2016 at 12:56 PM, Patrick Dowler <pdowler.cadc at gmail.com>
wrote:

> I checked more closely and while my own code for CAOM doesn't care
> about the winding direction* it does detect it correctly as CCW for A
> > 0, but when viewing the tangent plane from the outside... so what I
> wrote in the last sentence is wrong and my implementation agrees with
> what Felix says above. I think that also agrees with STC and a
> reference to STC is appropriate in this section of DALI.
>
> As for the agreement, we didn't agree on the details, just that we
> would pick a winding direction and allow polygons larger than half the
> sphere.
>
> As for impact, we store polygons with both winding directions in our
> CAOM database so I will have to recompute ~half of them. I'm fine with
> that.
>
> So, should I change the wording to say "when viewed from outside the
> unit sphere" and add STC reference? I want to say the minimum and
> leave the definitive specification in the hands of STC, but if we make
> readers go look it up in STC they will be annoyed.
>
> Pat
>
> On 8 September 2016 at 01:00, Felix Stoehr <fstoehr at eso.org> wrote:
> > Dear all,
> >
> > after some side-discussions with Marc I believe the following is true:
> >
> > - STC-S declares clockwise and counterclockwise with respect to the
> > celestial coordinate frame (north up, east to the left as seen from
> earth)
> >
> > - this is consistent with the footprintfineder.py output and thus all
> > the MAST/ALMA/ESA spectra
> >
> > - area calculations will be correct in this definition and coordinate
> frame
> >
> > - it is a bit counter-intuitive, because it means that anticklockwise
> > polygons in that definition are clockwise if you look up on the sky from
> > earth.
> >
> > It might be worthwile to declare in WD-DALI-1.1 the coordinate system in
> > which the clockwise/anticlockwise are defined, i.e. in which system to
> > "hold the clock".
> >
> > Best regards,
> >
> > Felix
> >
>
>
>
> --
> Patrick Dowler
> Canadian Astronomy Data Centre
> Victoria, BC, Canada
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ivoa.net/pipermail/dal/attachments/20160908/15f33c2e/attachment.html>


More information about the dal mailing list