cgal icon indicating copy to clipboard operation
cgal copied to clipboard

CGAL::Polyhedron_incremental_builder_3<HDS>::lookup_hole() error

Open mazerLIU opened this issue 3 years ago • 8 comments

Issue Details

Error is "input error: at vertex 31746 a closed surface already exists and facet 108501 is nonetheless adjacent"

Source Code

If your issue arises by using CGAL in your own source code, please provide a minimalist example that we can compile easily to reproduce the bug. If your issue arises from using a CGAL program (demo, example, etc.), please let us know which one. Helping you solving an issue is much easier and efficient if we can reproduce it.

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits):
  • Compiler:
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version:
  • Boost version:
  • Other libraries versions if used (Eigen, TBB, etc.):

mazerLIU avatar Jun 21 '22 07:06 mazerLIU

Hard to tell exactly what is the problem you are having without any detail but my guess is that you are try to have more than two faces along an edge (non-manifold surface).

sloriot avatar Jun 21 '22 07:06 sloriot

I try to convert my mesh to polyhdron.But some mesh convert to polyhdron with wrong. How to solve the bug?

mazerLIU avatar Jun 21 '22 08:06 mazerLIU

You need to share more information, like some code or the file itself. This example might also be interesting.

sloriot avatar Jun 21 '22 08:06 sloriot

template <class HDS>
	class WorkMesh_to_polyhedron : public CGAL::Modifier_base<HDS> {
	public:
		WorkMesh_to_polyhedron(const Work_Mesh &mesh) : m_mesh(mesh) {}
		void operator()(HDS& hds) {
			// get mesh data
			const std::vector<Work_Triangle>& mFirstTris = m_mesh.GetFaces();
			const std::vector<Point3D>& mFirstVers = m_mesh.GetVertices();
			// Postcondition: `hds' is a valid polyhedral surface.
			CGAL::Polyhedron_incremental_builder_3<HDS> B(hds, true);
			B.begin_surface(mFirstVers.size(), mFirstTris.size() / 3);
			// vertices
			typedef typename HDS::Vertex::Point Vertex;
			typedef typename Vertex Point;
			for (unsigned i = 0; i < mFirstVers.size(); i++) {
				HDS::Vertex_handle vh = B.add_vertex(Point(mFirstVers[i].x(), mFirstVers[i].y(), mFirstVers[i].z()));
				//vh->id = i;
			}
			// get all triangles
			std::vector<Vertex_Index> tempFs;

			for (unsigned i = 0; i < mFirstTris.size(); i++) {
				int p0 = mFirstTris[i].GetVerIndex(0);
				int p1 = mFirstTris[i].GetVerIndex(1);
				int p2 = mFirstTris[i].GetVerIndex(2);

				tempFs.push_back(Vertex_Index(p0));
				tempFs.push_back(Vertex_Index(p1));
				tempFs.push_back(Vertex_Index(p2));
			}

			// triangles
			for (unsigned j = 0; j < tempFs.size() / 3; ++j) {
				HDS::Face_handle fh = B.begin_facet();
				B.add_vertex_to_facet(tempFs[3 * j]);
				B.add_vertex_to_facet(tempFs[3 * j + 1]);
				B.add_vertex_to_facet(tempFs[3 * j + 2]);
				B.end_facet();
				//fh->id = j;
			}

			B.end_surface();
		}

	private:
		Work_Mesh m_mesh;
	};

mazerLIU avatar Jun 21 '22 08:06 mazerLIU

What is you input? Did you try to use the aforementioned example?

sloriot avatar Jun 21 '22 08:06 sloriot

Also, we have no idea what your WorkMesh type is. Is it 2-manifold (with border) ?

afabri avatar Jun 27 '22 16:06 afabri

The message indicates that there is a vertex v not on a border, and now comes yet another triangle that is incident to v.

afabri avatar Jun 27 '22 16:06 afabri

@mazerLIU it would be great to get a confirmation from you that the mesh is non manifold. We then can close the issue.

afabri avatar Aug 03 '22 11:08 afabri