Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Possible bug in volume intersection #62

Open
vmora opened this issue Oct 24, 2014 · 3 comments
Open

Possible bug in volume intersection #62

vmora opened this issue Oct 24, 2014 · 3 comments

Comments

@vmora
Copy link
Contributor

vmora commented Oct 24, 2014

Test the case where a non-convex volume intersects a convex volume where the result should be 2 volumes. In Intersection3d.cpp we only take the first volume, I suspect a bug.

@mhugo
Copy link
Contributor

mhugo commented Feb 27, 2016

@vmora what's the state of this issue ?

@vmora
Copy link
Contributor Author

vmora commented Mar 2, 2016

not tested yet

what I had in mind is:

st_intersection(st_extrude('POLGON((0 0,1 0,1 1,0 1,0 0))'::geometry, 0, 0, 1), st_extrude('POLGON((.7 0,1.7 0,1.7 1,.7 1,1.5 .5, 0 0))'::geometry, 0, 0, 1));

@danielcu888
Copy link
Contributor

danielcu888 commented Apr 22, 2020

@mhugo, @vmora this is duplicated by issue #200 which I created.

I adapted your example in to a unit test here (corrected a couple of typos and the non-closed Polygon):

BOOST_AUTO_TEST_CASE( testIssue62 )
{
  std::unique_ptr< Geometry > poly1 = io::readWkt( "POLYGON((0 0,1 0,1 1,0 1,0 0))" );
  std::unique_ptr< Geometry > solid1 = algorithm::extrude( *poly1, 0, 0, 1 );

  std::unique_ptr< Geometry > poly2 = io::readWkt( "POLYGON((0.7 0,1.7 0,1.7 1,0.7 1,1.5 0.5,0.7 0))" );
  std::unique_ptr< Geometry > solid2 = algorithm::extrude( *poly2, 0, 0, 1 );

  std::unique_ptr< Geometry > inx = algorithm::intersection3D( *solid1, *solid2 );

  std::cout << "inx: " << inx->asText() << std::endl;
}

with the Solid result:

SOLID((((1/1 3/16 0/1,1/1 0/1 0/1,7/10 0/1 0/1,1/1 3/16 0/1)),((7/10 0/1 0/1,7/10 0/1 3/10,1/1 3/16 0/1,7/10 0/1 0/1)),((1/1 0/1 0/1,7/10 0/1 3/10,7/10 0/1 0/1,1/1 0/1 0/1)),((1/1 3/16 0/1,1/1 3/16 5/8,1/1 0/1 0/1,1/1 3/16 0/1)),((7/10 0/1 3/10,1/1 3/16 5/8,1/1 3/16 0/1,7/10 0/1 3/10)),((1/1 0/1 0/1,1/1 0/1 7/10,7/10 0/1 3/10,1/1 0/1 0/1)),((1/1 3/16 5/8,1/1 0/1 7/10,1/1 0/1 0/1,1/1 3/16 5/8)),((7/10 0/1 3/10,7/10 0/1 1/1,1/1 3/16 5/8,7/10 0/1 3/10)),((1/1 0/1 7/10,7/10 0/1 1/1,7/10 0/1 3/10,1/1 0/1 7/10)),((1/1 3/16 5/8,1/1 3/16 13/16,1/1 0/1 7/10,1/1 3/16 5/8)),((7/10 0/1 1/1,1/1 3/16 13/16,1/1 3/16 5/8,7/10 0/1 1/1)),((1/1 0/1 7/10,1/1 0/1 1/1,7/10 0/1 1/1,1/1 0/1 7/10)),((1/1 3/16 13/16,1/1 0/1 1/1,1/1 0/1 7/10,1/1 3/16 13/16)),((7/10 0/1 1/1,23/26 3/26 1/1,1/1 3/16 13/16,7/10 0/1 1/1)),((1/1 0/1 1/1,23/26 3/26 1/1,7/10 0/1 1/1,1/1 0/1 1/1)),((1/1 3/16 13/16,1/1 3/16 1/1,1/1 0/1 1/1,1/1 3/16 13/16)),((23/26 3/26 1/1,1/1 3/16 1/1,1/1 3/16 13/16,23/26 3/26 1/1)),((1/1 0/1 1/1,1/1 3/16 1/1,23/26 3/26 1/1,1/1 0/1 1/1)),((1/1 1/1 1/1,7/10 1/1 7/10,7/10 1/1 1/1,1/1 1/1 1/1)),((7/10 1/1 1/1,1/1 13/16 1/1,1/1 1/1 1/1,7/10 1/1 1/1)),((7/10 1/1 7/10,1/1 13/16 1/1,7/10 1/1 1/1,7/10 1/1 7/10)),((1/1 1/1 1/1,1/1 1/1 3/10,7/10 1/1 7/10,1/1 1/1 1/1)),((1/1 13/16 1/1,1/1 13/16 3/8,1/1 1/1 1/1,1/1 13/16 1/1)),((7/10 1/1 7/10,1/1 13/16 3/8,1/1 13/16 1/1,7/10 1/1 7/10)),((1/1 1/1 3/10,7/10 1/1 0/1,7/10 1/1 7/10,1/1 1/1 3/10)),((1/1 1/1 1/1,1/1 13/16 3/8,1/1 1/1 3/10,1/1 1/1 1/1)),((7/10 1/1 7/10,7/10 1/1 0/1,1/1 13/16 3/8,7/10 1/1 7/10)),((1/1 1/1 3/10,1/1 1/1 0/1,7/10 1/1 0/1,1/1 1/1 3/10)),((1/1 13/16 3/8,1/1 13/16 3/16,1/1 1/1 3/10,1/1 13/16 3/8)),((7/10 1/1 0/1,1/1 13/16 3/16,1/1 13/16 3/8,7/10 1/1 0/1)),((1/1 1/1 0/1,23/26 23/26 0/1,7/10 1/1 0/1,1/1 1/1 0/1)),((1/1 1/1 3/10,1/1 13/16 3/16,1/1 1/1 0/1,1/1 1/1 3/10)),((7/10 1/1 0/1,23/26 23/26 0/1,1/1 13/16 3/16,7/10 1/1 0/1)),((1/1 1/1 0/1,1/1 13/16 0/1,23/26 23/26 0/1,1/1 1/1 0/1)),((1/1 13/16 3/16,1/1 13/16 0/1,1/1 1/1 0/1,1/1 13/16 3/16)),((23/26 23/26 0/1,1/1 13/16 0/1,1/1 13/16 3/16,23/26 23/26 0/1))))

whereas it should be the two part MultiSolid:

MULTISOLID(((((1/1 3/16 0/1,1/1 0/1 0/1,7/10 0/1 0/1,1/1 3/16 0/1)),((7/10 0/1 0/1,7/10 0/1 3/10,1/1 3/16 0/1,7/10 0/1 0/1)),((1/1 0/1 0/1,7/10 0/1 3/10,7/10 0/1 0/1,1/1 0/1 0/1)),((1/1 3/16 0/1,1/1 3/16 5/8,1/1 0/1 0/1,1/1 3/16 0/1)),((7/10 0/1 3/10,1/1 3/16 5/8,1/1 3/16 0/1,7/10 0/1 3/10)),((1/1 0/1 0/1,1/1 0/1 7/10,7/10 0/1 3/10,1/1 0/1 0/1)),((1/1 3/16 5/8,1/1 0/1 7/10,1/1 0/1 0/1,1/1 3/16 5/8)),((7/10 0/1 3/10,7/10 0/1 1/1,1/1 3/16 5/8,7/10 0/1 3/10)),((1/1 0/1 7/10,7/10 0/1 1/1,7/10 0/1 3/10,1/1 0/1 7/10)),((1/1 3/16 5/8,1/1 3/16 13/16,1/1 0/1 7/10,1/1 3/16 5/8)),((7/10 0/1 1/1,1/1 3/16 13/16,1/1 3/16 5/8,7/10 0/1 1/1)),((1/1 0/1 7/10,1/1 0/1 1/1,7/10 0/1 1/1,1/1 0/1 7/10)),((1/1 3/16 13/16,1/1 0/1 1/1,1/1 0/1 7/10,1/1 3/16 13/16)),((7/10 0/1 1/1,23/26 3/26 1/1,1/1 3/16 13/16,7/10 0/1 1/1)),((1/1 0/1 1/1,23/26 3/26 1/1,7/10 0/1 1/1,1/1 0/1 1/1)),((1/1 3/16 13/16,1/1 3/16 1/1,1/1 0/1 1/1,1/1 3/16 13/16)),((23/26 3/26 1/1,1/1 3/16 1/1,1/1 3/16 13/16,23/26 3/26 1/1)),((1/1 0/1 1/1,1/1 3/16 1/1,23/26 3/26 1/1,1/1 0/1 1/1)),((1/1 1/1 1/1,7/10 1/1 7/10,7/10 1/1 1/1,1/1 1/1 1/1)),((7/10 1/1 1/1,1/1 13/16 1/1,1/1 1/1 1/1,7/10 1/1 1/1)),((7/10 1/1 7/10,1/1 13/16 1/1,7/10 1/1 1/1,7/10 1/1 7/10)),((1/1 1/1 1/1,1/1 1/1 3/10,7/10 1/1 7/10,1/1 1/1 1/1)),((1/1 13/16 1/1,1/1 13/16 3/8,1/1 1/1 1/1,1/1 13/16 1/1)),((7/10 1/1 7/10,1/1 13/16 3/8,1/1 13/16 1/1,7/10 1/1 7/10)),((1/1 1/1 3/10,7/10 1/1 0/1,7/10 1/1 7/10,1/1 1/1 3/10)),((1/1 1/1 1/1,1/1 13/16 3/8,1/1 1/1 3/10,1/1 1/1 1/1)),((7/10 1/1 7/10,7/10 1/1 0/1,1/1 13/16 3/8,7/10 1/1 7/10)),((1/1 1/1 3/10,1/1 1/1 0/1,7/10 1/1 0/1,1/1 1/1 3/10)),((1/1 13/16 3/8,1/1 13/16 3/16,1/1 1/1 3/10,1/1 13/16 3/8)),((7/10 1/1 0/1,1/1 13/16 3/16,1/1 13/16 3/8,7/10 1/1 0/1)),((1/1 1/1 0/1,23/26 23/26 0/1,7/10 1/1 0/1,1/1 1/1 0/1)),((1/1 1/1 3/10,1/1 13/16 3/16,1/1 1/1 0/1,1/1 1/1 3/10)),((7/10 1/1 0/1,23/26 23/26 0/1,1/1 13/16 3/16,7/10 1/1 0/1)),((1/1 1/1 0/1,1/1 13/16 0/1,23/26 23/26 0/1,1/1 1/1 0/1)),((1/1 13/16 3/16,1/1 13/16 0/1,1/1 1/1 0/1,1/1 13/16 3/16)),((23/26 23/26 0/1,1/1 13/16 0/1,1/1 13/16 3/16,23/26 23/26 0/1)))))

the cause being the two disjoint 3-cells resulting from the polyline intersections between the two boundaries being collectively processed by the Volume_import_modifier resulting in the first generated output Polyhedron containing two disjoint components.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants