Opened 17 years ago

Last modified 15 years ago

#158 closed defect

Some external rings dropped during buffer operation — at Version 3

Reported by: carl.anderson@… Owned by: strk@…
Priority: major Milestone: 3.2.0
Component: Core Version: main
Severity: Critical Keywords: imported, phpbugtracker
Cc: mloskot

Description (last modified by mloskot)

sample for XMLTester

<run>
<!--precisionModel scale="1.0" offsetx="0.0" offsety="0.0"/-->
<precisionModel type="FLOATING"/>
<case>
<desc>

Test One Outer ring is returned instead of two outer rings. One of the Polygons is not in the resultant set

</desc>
<a>
MULTIPOLYGON (((
            139 819, 
            485 185, 
            139 184, 
            139 819
        )), ((
            215 1191, 
            1620 1203, 
            1483 0, 
            215 1191
        )))
</a>
<test>
<desc>

Buffer One Outer ring is returned instead of two outer rings. One of the Polygons is not in the resultant set

</desc>

<op name="buffer" arg1="a" arg3="0.0">
MULTIPOLYGON (((
            527 725, 
            349 334, 
            128 193, 
            527 725
        )), ((
            215 1191, 
            1620 1203, 
            1483 0, 
            215 1191
        )))</op>
</test>
</case>
</run>

Change History (5)

by carl.anderson@…, 17 years ago

Attachment: u5small.xml added

XMLTester file

by carl.anderson@…, 17 years ago

Attachment: SubgrahpDepthLocater.patch added

patch with a incomplete hack to fix and lots of comments

comment:1 by carl.anderson@…, 17 years ago

apply the patch to make SubgraphDepthLocater more chatty

Notice that the LineSegments pushed back into the stabbedSegments list are NOT the same

as the values retrieved from the list

Need to fix this by adding a deep copy to the constructor for DepthSegment


bash-3.2$ XMLTester -v u5small.xml
 SubgraphDepthLocater::findStabbedSegments:  evaluate segment 0 (215 1191 1620 1203)  segment above or below stabbing line, skipping 
 SubgraphDepthLocater::findStabbedSegments:  evaluate segment 1 (1620 1203 1483 0)      depth: 1  right:1, left:0 swapped:1
     push back: (LINESEGMENT(1483 0,1620 1203) 1)
 SubgraphDepthLocater::findStabbedSegments:  evaluate segment 2 (1483 0 215 1191)      depth: 0  right:1, left:0 swapped:0
     push back: (LINESEGMENT(1483 0,215 1191) 0)
 SubgraphDepthLocater::DepthSegmentLessThen LINESEGMENT(1483 0,215 1191):0  LINESEGMENT(1483 0,215 1191):1 == 0
 SubgraphDepthLocater::getDepth()
   found these stabbed segments
    (0: LINESEGMENT(1483 0,215 1191) 0)
    (1: LINESEGMENT(1483 0,215 1191) 1)

SubgraphDepthLocater::getDepth(485 185): 0




comment:2 by carl.anderson@…, 17 years ago

Issue was that DepthSegment was not createing a copy of the LineSegment and was only cachign the pointer passed.

Except that findStabbedSegments was repeatedly initializing DepthSegments using the same var pointer.

This patch causes a copy of the LineSegment to be made.
Other corrective techniques exist.


--- SNIP ---
--- source/operation/buffer/SubgraphDepthLocater.cpp.orig       2007-02-21 05:14:20.000000000 -0500
+++ source/operation/buffer/SubgraphDepthLocater.cpp    2007-07-23 21:36:16.000000000 -0400
@@ -55,7 +55,7 @@
 
 private:
 
-       geom::LineSegment& upwardSeg;
+       geom::LineSegment upwardSeg;
 
        /*
         * Compare two collinear segments for left-most ordering.
@@ -81,12 +81,14 @@
        int leftDepth;
 
        DepthSegment(geom::LineSegment &seg, int depth)
-               :
-               upwardSeg(seg),
-               leftDepth(depth)
+//             :
+//             upwardSeg(seg),
+//             leftDepth(depth)
        {
                // input seg is assumed to be normalized
                //upwardSeg.normalize();
+               leftDepth = depth;
+               upwardSeg = seg;
        }
 
        /**




comment:3 by mloskot, 16 years ago

Cc: mloskot added
Description: modified (diff)
Note: See TracTickets for help on using tickets.