Opened 6 weeks ago
Last modified 6 days ago
#5817 new defect
CG_3DIntersection gives wrong result with LINESTRING and Solid — at Initial Version
Reported by: | nbvfgh | Owned by: | lbartoletti |
---|---|---|---|
Priority: | critical | Milestone: | PostGIS 3.6.0 |
Component: | sfcgal | Version: | 3.5.x |
Keywords: | Cc: |
Description
SELECT ST_IsClosed('POLYHEDRALSURFACE Z ( ((-1 1 -1,1 1 -1,1 -1 -1,-1 -1 -1,-1 1 -1)), ((-1 1 1,-1 -1 1,1 -1 1,1 1 1,-1 1 1)), ((-1 1 -1,-1 1 1,1 1 1,1 1 -1,-1 1 -1)), ((1 1 -1,1 1 1,1 -1 1,1 -1 -1,1 1 -1)), ((1 -1 -1,1 -1 1,-1 -1 1,-1 -1 -1,1 -1 -1)), ((-1 -1 -1,-1 -1 1,-1 1 1,-1 1 -1,-1 -1 -1)))'); -- result:{true}
Then we make the closed POLYHEDRALSURFACE a Solid, and use CG_3DIntersection to get the Interaction with the Solid and Linestring, which we get the unexpected result.
WITH solid AS ( SELECT CG_MakeSolid('POLYHEDRALSURFACE Z ( ((-1 1 -1,1 1 -1,1 -1 -1,-1 -1 -1,-1 1 -1)), ((-1 1 1,-1 -1 1,1 -1 1,1 1 1,-1 1 1)), ((-1 1 -1,-1 1 1,1 1 1,1 1 -1,-1 1 -1)), ((1 1 -1,1 1 1,1 -1 1,1 -1 -1,1 1 -1)), ((1 -1 -1,1 -1 1,-1 -1 1,-1 -1 -1,1 -1 -1)), ((-1 -1 -1,-1 -1 1,-1 1 1,-1 1 -1,-1 -1 -1)))') geom ) SELECT ST_AsText(CG_3DIntersection( 'LINESTRING (-2 0 0, 2 0 2)'::geometry, solid.geom )), ST_AsText(CG_3DIntersection( 'LINESTRING (-2 0 0,0 0 1,2 0 2)'::geometry, solid.geom )) FROM solid; -- expected: {{LINESTRING Z (-1 0 0.5,0 0 1)},{LINESTRING Z (-1 0 0.5,0 0 1)}} -- actual : {{POINT Z (-1 0 0.5)},{LINESTRING Z (-1 0 0.5,0 0 1)}}
To verify that the issue is not caused by differences in the two Linestrings, we ran the following query:
SELECT ST_AsText(CG_3DIntersection( 'LINESTRING (-2 0 0,2 0 2)'::geometry, 'POLYHEDRALSURFACE Z (((-1 1 -1,1 1 -1,1 -1 -1,-1 -1 -1,-1 1 -1)),((-1 1 1,-1 -1 1,1 -1 1,1 1 1,-1 1 1)),((-1 1 -1,-1 1 1,1 1 1,1 1 -1,-1 1 -1)),((1 1 -1,1 1 1,1 -1 1,1 -1 -1,1 1 -1)),((1 -1 -1,1 -1 1,-1 -1 1,-1 -1 -1,1 -1 -1)),((-1 -1 -1,-1 -1 1,-1 1 1,-1 1 -1,-1 -1 -1)))' )), ST_AsText(CG_3DIntersection( 'LINESTRING (-2 0 0,0 0 1,2 0 2)'::geometry, 'POLYHEDRALSURFACE Z (((-1 1 -1,1 1 -1,1 -1 -1,-1 -1 -1,-1 1 -1)),((-1 1 1,-1 -1 1,1 -1 1,1 1 1,-1 1 1)),((-1 1 -1,-1 1 1,1 1 1,1 1 -1,-1 1 -1)),((1 1 -1,1 1 1,1 -1 1,1 -1 -1,1 1 -1)),((1 -1 -1,1 -1 1,-1 -1 1,-1 -1 -1,1 -1 -1)),((-1 -1 -1,-1 -1 1,-1 1 1,-1 1 -1,-1 -1 -1)))' )); -- expected: {{MULTIPOINT Z ((-1 0 0.5),(0 0 1))},{MULTIPOINT Z ((-1 0 0.5),(0 0 1))} -- actual : {{MULTIPOINT Z ((-1 0 0.5),(0 0 1))},{MULTIPOINT Z ((-1 0 0.5),(0 0 1))}
The intersection between the original POLYHEDRALSURFACE and these two linestrings yielded the same result, so there should be some bugs in the operation of the intersection between Solid and Linestring.
Note:
See TracTickets
for help on using tickets.