<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>After some reflexion, discussion with colleagues, and considering
      that we<br>
      probably want a unique way to describe a same polygon in different
      celestial<br>
      reference frame (i.e. we do not want to have to change the order
      of the vertices <br>
      when changing the frame), here a new proposition which I believe
      to be<br>
      <b>**compatible with the current definition for convex polygons**</b>
      and which is compatible <br>
      with self-intersecting polygons.<br>
      <br>
      We choose as "reference" point the centroid of the first 3
      vertices<br>
      which are not on a same great-circle (mathematically,<br>
      the "reference" point p = v1+v2+v3 / ||v1+v2+v3||).<br>
      p is inside the polygon if it is located on the left of the first
      segment<br>
      (i.e. if (v1 x v2).p &gt; 0), else it is outside.<br>
    </p>
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">Le 14/06/2018 à 18:22, Arnold Rots a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJXToE-JNhy+kXoy2ahHhOEsvuQJwEAad71=TXLgYw-geuv57w@mail.gmail.com">
      <div dir="ltr">
        <div>The downside is that this only applies to spherical
          celestial coordinate systems.</div>
        <div>And I maintain that it is a very bad idea to allow
          self-intersecting polygons.</div>
        <div><br>
        </div>
        <div>  - Arnold<br>
        </div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div class="gmail_signature" data-smartmail="gmail_signature">
            <div dir="ltr">-------------------------------------------------------------------------------------------------------------<br>
              Arnold H. Rots                                         
              Chandra X-ray Science Center<br>
              Smithsonian Astrophysical Observatory                  
              tel:  +1 617 496 7701<br>
              60 Garden Street, MS 67                                   
                fax:  +1 617 495 7356<br>
              Cambridge, MA 02138                                    
                  <a href="mailto:arots@cfa.harvard.edu"
                target="_blank" moz-do-not-send="true">arots@cfa.harvard.edu</a><br>
              USA                                                   <a
                href="http://hea-www.harvard.edu/%7Earots/"
                target="_blank" moz-do-not-send="true">http://hea-www.harvard.edu/~arots/</a><br>
--------------------------------------------------------------------------------------------------------------<br>
              <br>
            </div>
          </div>
        </div>
        <br>
        <div class="gmail_quote">On Thu, Jun 14, 2018 at 9:13 AM,
          Francois-Xavier PINEAU <span dir="ltr">&lt;<a
              href="mailto:francois-xavier.pineau@astro.unistra.fr"
              target="_blank" moz-do-not-send="true">francois-xavier.pineau@astro.unistra.fr</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex"><span
              class=""><br>
              Le 13/06/2018 à 23:58, Markus Nullmeier a écrit :<br>
              <blockquote class="gmail_quote" style="margin:0 0 0
                .8ex;border-left:1px #ccc solid;padding-left:1ex">
                Hello list,<br>
                <br>
                On 13/06/18 10:05, Francois-Xavier PINEAU wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  Example: if we take the case of a simple 4 vertices's
                  polygon having a<br>
                  butterfly shape (i.e. having two crossing great-circle
                  arcs), then the<br>
                  inside of one "wing" is in the counter-clockwise sense
                  while the inside<br>
                  of the other "wing" is in the clockwise sense.<br>
                </blockquote>
                Well, a definition that allows polygon edges to
                intersect would be<br>
                unsound, probably in several ways. One of them is the
                mentioned<br>
                inability to describe the complement of a polygon as a
                single polygon.<br>
              </blockquote>
            </span>
            Ok, a polygon (defined by a list of successive vertices)
            defines two complementary areas on the unit sphere.<br>
            To know which one is considered as being inside the polygon,
            why not taking a reference point like the North pole (N):<br>
            <br>
            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) &gt; 0), then N is in the area
            considered as being inside the polygon, else it is in the
            outside area.<br>
            <br>
            <br>
            I see one possible complication:<br>
             if N is a vertex or on an edge of the polygon, then:<br>
             - the first edge must not contain N<br>
             - if N is considered as inside: the inside is defined by
            the area(s) on the left part of the edge(s) containing N<br>
             - if N is considered as outside: the inside is the
            complement of the area considering N inside<br>
            <br>
            This simple definition is able to deal with both simple and
            self-intersecting polygons.<br>
            <br>
            In attachment, 3 large polygons (2 self intersecting, and
            one having a surface area &gt; 2*pi): I adapted the
            following 10 lines of code (in 2d) to the spherical case (<a
href="https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html"
              rel="noreferrer" target="_blank" moz-do-not-send="true">https://wrf.ecse.rpi.edu//Res<wbr>earch/Short_Notes/pnpoly.html</a>)<wbr>.<br>
            <br>
            Kind regards,<br>
            <br>
            <br>
            François-Xavier<br>
            <br>
            <br>
            <br>
            <br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>