Opened 6 weeks ago
Last modified 4 days ago
#5817 new defect
CG_3DIntersection gives wrong result with LINESTRING and Solid
Reported by: | nbvfgh | Owned by: | lbartoletti |
---|---|---|---|
Priority: | critical | Milestone: | PostGIS 3.6.0 |
Component: | sfcgal | Version: | 3.5.x |
Keywords: | Cc: |
Description (last modified by )
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.
Version:POSTGIS="3.6.0dev 3.5.0-91-g593df9088" [EXTENSION] PGSQL="170" GEOS="3.13.0-CAPI-1.19.0" SFCGAL="SFCGAL 1.5.2, CGAL 5.6.1, BOOST 1.84.0"
Change History (2)
comment:1 by , 3 weeks ago
Milestone: | PostGIS 3.5.1 → PostGIS 3.5.2 |
---|
comment:2 by , 4 days ago
Description: | modified (diff) |
---|---|
Milestone: | PostGIS 3.5.2 → PostGIS 3.6.0 |