<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial>Hi all,</FONT></DIV>
<DIV><FONT face=Arial>Here is a copy of a question I sent in July. Since I did 
not receive any answer yet, I post it again.&nbsp;</FONT></DIV>
<DIV><FONT face=Arial>Thanks</FONT></DIV>
<DIV><FONT face=Arial>Maude Giasson</FONT></DIV>
<DIV><FONT 
face=Arial>-------------------------------------------------------------------------------------------------------------------<BR>I'm 
doing a small application using GEOS.<BR><BR>Given two simple linearRings L1 and 
L2, my application create a new<BR>linearRing L3 which is similar to L1 but 
contains, in addition, new vertex<BR>at the points where L1 and L2 
cross.<BR><BR>If L1 and L2 cross on a&nbsp;vertex of L1, no vertex is 
added.<BR><BR>If L1 and L2 share a common lineSegment, vertex are added to L3 at 
the<BR>endPoints of the segment. (if they are not already vertex on 
L3).<BR><BR>In consequence, every edges and vertex&nbsp;of L3 should be within 
L1.<BR><BR>1- Does a similar function already exists in GEOS (I haven't find 
any) ?<BR><BR>2- Later in my application, I look if the edges of L3 are within 
L1 or not<BR>(they should be within L1). It does not work pretty well. The 
problem seems<BR>to come from GEOS which is not always consistent in it's 
answers. In fact, I<BR>think the real problem is from my side because I do not 
know what I can<BR>expect from GEOS answers.<BR>I've made here a little example 
showing some GEOS results that I don't<BR>understand. Can someone please tell me 
what is wrong in that example?<BR>Understanding this particular example will 
help me solving problems in my<BR>application.</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>3- I'd like to have more information about the 
precisionModel. How does it work ?</FONT><FONT></DIV>
<DIV><BR><BR><FONT face=Arial>In that example, GEOS says that the LineString AB 
intersects the LineString<BR>XCDY at the point E.<BR>However,&nbsp; it says that 
LineString XCDY does not intersect point E.<BR>In consequence, the line segment 
ED is not within XCDY.<BR><BR>//Coordinate :<BR>geos::Coordinate 
cA(3.8727033436298370, 34.142325401306152);<BR>geos::Coordinate 
cB(22.790718823671341, 34.684023857116699);<BR>geos::Coordinate 
cC(15.851628303527832, 42.153842926025391);<BR>geos::Coordinate 
cD(4.8595705032348633, 28.923076629638672);<BR>geos::Coordinate 
cX(12,55);<BR>geos::Coordinate cY(4,28);<BR></FONT></DIV></FONT>
<DIV><FONT face=Arial>//Coordinate E will be given by GEOS and the values are 
the following :</DIV></FONT>
<DIV><FONT face=Arial>// E : 9.3254120334165922, 34.298458262089483</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>geos::PrecisionModel g_precisionModel;<BR>int g_SRID = 
1;</FONT></DIV><FONT face=Arial>
<DIV><BR>//-- ls AB construction<BR>geos::BasicCoordinateList* bclAB = new 
geos::BasicCoordinateList();<BR>bclAB-&gt;add(cA);<BR>bclAB-&gt;add(cB);<BR>geos::LineString* 
lsAB = new geos::LineString(bclAB, &amp;g_precisionModel,<BR>g_SRID);</DIV>
<DIV><BR>//-- ls XCDY construction<BR>geos::BasicCoordinateList* bclXCDY = new 
geos::BasicCoordinateList();<BR>bclXCDY-&gt;add(cX);<BR>bclXCDY-&gt;add(cC);<BR>bclXCDY-&gt;add(cD);<BR>bclXCDY-&gt;add(cY);<BR>geos::LineString* 
lsXCDY = new geos::LineString(bclXCDY, 
&amp;g_precisionModel,<BR>g_SRID);<BR><BR>//-- intersection between the 2 
lineStrings<BR>geos::Geometry* gABinterXCDY = 
lsAB-&gt;intersection(lsXCDY);<BR><BR>//The intersection between lineStrings AB 
and XCDY occurs at the single<BR>point of coordinate E&nbsp;(9.3254120334165922, 
34.298458262089483)<BR>//E is on AB and on CD. Let's verify that XCDY contains 
line segment<BR>(lineString) ED.<BR><BR>//-- ls ED 
construction<BR>geos::BasicCoordinateList* bclED = new 
geos::BasicCoordinateList();<BR>bclED-&gt;add( 
geos::Coordinate(*(gABinterXCDY-&gt;getCoordinate())) 
);<BR>bclED-&gt;add(cD);<BR>geos::LineString* lsED = new geos::LineString(bclED, 
&amp;g_precisionModel,<BR>g_SRID);<BR><BR>//-- <STRONG>lsXCDY should contain 
lsED but it does not; why ?<BR></STRONG>Booleen test3 = 
lsXCDY-&gt;contains(lsED); // why is it false<BR><BR>// gABinterXCDY = lsAB 
inter lsXYCD<BR>// but lsXCDY does not intersect gABinterXCDY.<BR>// <STRONG>Why 
does it occur ?</STRONG><BR>Booleen test1 = lsXCDY-&gt;intersects(gABinterXCDY); 
// <EM>why is it false ?</EM><BR><BR><BR>Thanks<BR>Maude 
Giasson<BR></DIV></FONT></BODY></HTML>