Cuboide dentro de poliedro genérico

I am searching for an efficient algorithm to find if a cuboid is completely inside or completely outside or (not-inside and not-outside) a generic (concave or convex) polyhedron. The polyhedron is defined by a list of 3D points and a list of facets. Each facet is defined by the subset of the contour points ordinated such as the right-hand normal points outward the solid.

Cualquier sugerencia?

Gracias

preguntado el 12 de junio de 14 a las 10:06

3 Respuestas

For one polyhedron (cuboid) to be completely inside or completely outside other polyhedron, there should be no intersections between there faces.

Check if any polyhedron face intersect any cuboid face. If there is intersection than cuboid is partially inside. If there is no intersection, check one cuboid corner point is it inside polyhedron. If corner point is inside, than cuboid is completely inside, if not than cuboid is completely outside.

Respondido el 12 de junio de 14 a las 12:06

Do you think that, in some way, I can exploit the fact that the first polyhedron is a cuboid? Maybe in the facets intersection algo - DOFHandler

Cuboid is convex. It can be used to easy eliminate polyhedron faces to test for intersection. Take one cuboid face, for each polyhedron point find on which side of that face is. Polyhedron face that has all points on outside doesn't intersect cuboid. If whole polyhedron face is on inside of cuboid face, than it doesn't intersect that face. That can be done for all cuboid faces. Also, if cuboid is parallelepiped, than this check can be done faster for two opposite cuboid faces. - Apuesta inicial

My suggestion: implement a cutting algorithm for polyhedra. I mean split a polyhedron in two by means of a plane.

For every vertex you can compute the algebraic distance to the plane.

Consider every face of the polyhedron in turn and cut it with the plane. If all vertices are on the same side of the plane, there is no intersection. You will keep the face as such or completely discard it. If there are vertices on either sides, then you will keep some of the edges intact, split those that cross and discard others. You will reconstruct the cut face by joining the vertices in the proper order (after sorting the piercing points along the intersection line).

After doing that, you will have a new set of faces forming a polyhedron, with a cover face missing. You will reconstruct it by joining the piercing points, using the same edges that were used to close the faces. (Actually, you may end up forming several faces because the cross section can be made of several pieces.)

When you are able to cut a polyhedron with a plane, then you are able to find its intersection with an arbitrary convex polyhedron, such as a cube.

What I just described is a generalization to 3D of the Sutherland–Hodgman clipping algorithm.

There is a happy case when the polyhedron vertices are all on the same size of some of the planes. You may start the work by doing this test. But for the other cases, there is no real shortcut.

You can implement bounding box tests on the volumes, faces and edges, hoping to get speedup, but the more you put such tests, the less they are efficient.

The case of intersection with a convex polyhedron is easier to implement as all faces remain convex and the topological changes are simpler.

Respondido el 12 de junio de 14 a las 18:06

A possible improvement over brute force checking every facet-pair for intersection: (my presumption is the facet-facet check is very expensive)

  • first compute the convex envelope of the non-convex polyhedron.
  • check if you are in the convex envelop (relatively cheaply) by insideness checking vertices.
  • do an insideness check for all vertices in the non-convex polyhedron*
  • if all vertices are entirely inside or entirely outside the non-convex polygon you must do a facet-facet intersection check pero only on the facets that are no part of the convex envelope.

*this step needed to catch case you are entirely between the two surfaces.

Respondido el 12 de junio de 14 a las 16:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.