<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    This algorithm will work if you can guarantee that there will be no
    overlapping line segments on your linestrings. If overlaps are
    possible, you will get a mixture of 4 line segment intersections and
    pairs of 3 line segment intersections with overlap between them.<br>
    <br>
    To robustly determine if you have a transverse intersection between
    2 linestrings:<br>
    <br>
    - create a circle centered at the intersection point (4 segment
    case) or at the start and end of the overlap interval (3 segment
    case)<br>
    - decompose each circle into two circular arcs where one line string
    intersects the circle<br>
    <br>
    You have a transverse intersection if the incoming line segment of
    the other linestring intersects a different circular arc than the
    outgoing line segment.<br>
    <br>
    On 30/05/2012 5:26 PM, Martin Davis wrote:
    <blockquote cite="mid:4FC6828C.9060500@telus.net" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      The DE-9IM model isn't designed to be able to distinguish between
      these two cases, so there's no way to compute this by using any of
      the named predicates, or even a custom relate matrix.  <br>
      <br>
      You could do this via some fairly straightforward custom code. 
      The algorithm is:<br>
      -  identify vertices in each linestring which are coincident<br>
      - build a simple "local topology" for the 4 incident line segments
      at each intersection<br>
      - examine the intersection to see if the segments alternate or are
      adjacent (you can do this by using the angles of the segments)<br>
      <br>
      On 5/30/2012 3:40 AM, Jasmin FORMONT wrote:
      <blockquote
cite="mid:4DDD462E988B52488DA728A04EF7C57454DEFDADC3@Eucles.Siradel.local"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=ISO-8859-1">
        <meta name="Generator" content="Microsoft Word 12 (filtered
          medium)">
        <style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
        <div class="Section1">
          <p class="MsoNormal"><span lang="EN-US">Hi everyone<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">I can’t find a way to
              tell if two linestrings “really” cross each other.<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">For instance if I have
              this linestring :<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">Line1 : LINESTRING(0
              0, 1 1, 2 0)<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">How can I
              differentiate the relation of line 1 with one of the
              following :<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">Line2 : LINESTRING(0
              2, 1 1, 2 2)    -> no “real” cross, just a contact
              point<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">Line3 : LINESTRING(0
              2, 1 1, 1 0)    -> lines “really” cross each other<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US">I can’t find a good
              combination of crosses, touches, etc… to differentiate
              these cases.<o:p></o:p></span></p>
          <p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
          <br>
        </div>
      </blockquote>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
geos-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:geos-devel@lists.osgeo.org">geos-devel@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/geos-devel">http://lists.osgeo.org/mailman/listinfo/geos-devel</a></pre>
    </blockquote>
  </body>
</html>