Considering the following query I expect both geomb
and geomc
to 3D Intersect with geoma
. According to postgis, only geomc intersects. Unfortunately I can't come up with a more simplified polygon as an example, this situation seems largely to depend on the configuration of the polygon.
WITH data AS (
SELECT
ST_SetSrid(ST_GeometryFromText('
POLYGON Z ((
122409.416 489410.194 6.64975853832649,
122404.759 489412.266 3.76021877729423,
122407.18 489417.708 3.82360012934401,
122405.377 489418.511 2.70471051793069,
122406.754 489421.606 2.74081838637221,
122408.218 489420.954 3.64933000361367,
122409.263 489423.303 3.67668436361495,
122407.787 489423.959 2.76102260948305,
122409.313 489427.389 2.80101513611236,
122411.091 489426.598 3.90419939305872,
122411.172 489426.781 3.9061156669998,
122409.45 489427.547 2.83769648670792,
122410.905 489430.819 2.87547799988339,
122412.594 489430.067 3.92357220158512,
122413.511 489432.131 3.94697470225165,
122411.723 489432.926 2.83768486408258,
122413.229 489436.312 2.87694266543155,
122414.931 489435.555 3.93292998257874,
122415.345 489436.484 3.94412204281057,
122420.157 489434.343 6.9298432176791,
122409.416 489410.194 6.64975853832649
))
'),28992) as geoma,
ST_Extrude(ST_SetSrid(ST_GeometryFromText('
LINESTRING Z (
122412.982 489429.097 0,
122414.559 489432.685 0
)
'),28992),0,0,10) as geomb,
ST_Extrude(ST_SetSrid(ST_GeometryFromText('
LINESTRING Z (
122414.559 489432.685 0,
122412.756 489433.477 0
)
'),28992),0,0,10) as geomc
)
SELECT
ST_3DIntersects(geoma,geomb) ab,
ST_3DIntersects(geoma,geomc) ac
FROM data;
Results in:
f;t
Would this be a bug in postgis/geos/sfcgal?
Please note: the given geoma above is non-planar because of rounding when exporting to text. In the database it shows ST_IsPlanar(geoma)
as true
and gives the same results. On top of that, in the database running ST_3DIntersection
on geoma vs. geomb and geoma vs. geomc both give a good result. This is not replicable here because of non-planarity.
The situation is perhaps better described in this picture, where geoma is blue, geomb is red and geomc is green. The geometries in the image have been Tesselated for display purpose only.