Removing the parts of surface which are outliers after running Screened Poisson Reconstruction in Meshlab - mesh

after running the Screened Poisson Reconstruction in Meshlab, I got the mesh with some extended surface as in this figure
Does meshlab support any tools for removing that?

MeshLab is using an implementation of PoissonRecon, which is found here:
https://github.com/mkazhdan/PoissonRecon
What you are seeing is due to the default boundary condition used by the algorithm, which is a Neumann boundary condition. Unfortunately, MeshLab does not allow you to modify which boundary condition is being used for the Poisson solver. If you compile the actual source code, you can specify the Dirichlet boundary condition as a command line argument, which will prevent you from having this large open surface.
If you have issues with disconnected pieces, you can use the SurfaceTrimmer program from the same repo.

Try to use the filter - select Faces with edges longer than... and set the threshold you want.

Related

CGAL cut cube with arbitrary surface

I'm new to CGAL and I'm trying to cut a cube with an arbitrary surface mesh in 3d (no self intersections, not closed/no volume). The goal is to get a volume which consists of one "side" of the cut cube, closed by the part of the surface inside the cube.
The surface itself consists of unordered triangles which should have the same winding order (consistent normal directions) but have no neighborhood information and could contain same points multiple times for different triangles.
I tried to use the clip function, like:
CGAL::Polygon_mesh_processing::clip(cube,surface,true);
Which of course does not work because the surface is not closed (as far as I understood). But It shows the idea on how the operation should work.
Boolean operations (https://doc.cgal.org/latest/Polygon_mesh_processing/index.html#title14)) cannot be used for this as well since they are calculated on volumes and the surface has no volume.
I also thought about extending the outside of the surface so that it is closed. This, however, does not seem like a good approach.
Sadly, my research on similar problems was not successful.
I'm pretty sure that there is a nice way to do this in CGAL. Maybe someone with more experience in CGAL knows how to do this.
What would be the best approach for getting this volume?
Regards
EDIT:
By removing redundant points in my surface mesh I was able to get clip to work. Nevertheless, I do not always get the right side of the volume, even though the winding order should yield normals which point to the outside.
Is it necessary to calculate the normals and pass them as an extra parameter (see here) of the surface before the cut in order to always get the same "inner" side of the volume?
Also, the clip function seems to be quite slow. I have to do this cut for a very high number of cubes and different surfaces.
I use CGAL as header only lib and without GMP and MPFR, since it crashed my other application. How big is the speedup using these libraries and are there any other tricks which can be used to speedup computation, e.g. using parallelization?
I saw that CGAL uses Intel's TBB which. But in the header files which are included by the clipping algorithm CGAL_LINKED_WITH_TBB is not tested.
Thanks
It was a problem with the clipping mesh. Clipping could not be done properly. I increased it size and now it always intersects the volume.

CGAL: Simplify convex polyhedra in 3D

I have been using the cgal library to generate convex hulls which are further used for discrete element simulations. Currently, I am trying to make the polyhedral particles break, which is right now implemented as plane clipping of the polyhedron. The problem is that after several (sometimes even one) clipping, the polyhedrons start having "bad" attributes, such as nearly degenerate faces, nearly coplanar edges or nearly degenerate edges, which cause problems in the contact calculation. I have been looking at CGAL/Surface_mesh_simplification routines and used the edge_collapse function, but it does not preserve convexity of the particles. Is there any way to use routines from cgal for convex polyhedra simplifications while preserving convexity?
You can try using the function isotropic_remeshing(). While there is no guarantee that the output will stay convex, the points are guaranteed to be on the input mesh. If you have some sharp edges you want to preserve, you can specify it to the function and it will take them into account.

3d surface triangulation of an open surface with CGAL

I'm a newbie to CGAL library. However, I think it's a very suitable package for what I want to do.
I have a set of points representing a 3D surface (as shown in figure 1).
I want to fit a 3d triangulation on this surface. The surface is not closed and therefore does not occupy a volume. The code provided in poisson_reconstruction_example.cpp seems appropriate for this job. But the problem is that as a part of poisson_reconstruction algorithm it closes the ends and underneath of the surface to make it a volume (see figure2).
I was wondering:
1- Is there a way to do the triangulation on the surface just defined by the points, without getting a closed surface which encloses a finite volume?
This means that the final triangulation has boundary edges.
I'm happy with any Upsampling or smoothing which may be needed.
2- If the answer to the first question is no, then, is there any way to guarantee that the input points are the vertices of the generated triangles?
The poisson surface reconstruction generates a close surface that interpolates the point cloud given as input. It requires as input a point set with normals.
If you need a algorithm that only uses input points in the output, you can try the Advancing Front Surface Reconstruction algorithm.

CGAL 3D surface mesh generation for unbounded implicit surfaces

This is again a question about the CGAL 3D surface mesher.
http://doc.cgal.org/latest/Surface_mesher/index.html#Chapter_3D_Surface_Mesh_Generation
With the definition
Surface_3 surface(sphere_function, // pointer to function
Sphere_3(CGAL::ORIGIN, 64.0)); // bounding sphere
(as given too in the example code) I define an implicit surface given by 'sphere function' and a Sphere_3 of radius 8.
The difference is now, that the zeros of 'sphere function' are (contrary to its now misleading name) no longer bounded and inside Sphere_3. Instead 'sphere_function' represents an unbounded surface (think of x^2 + y^2 - z^2 - 1 = 0) and my intention is to triangularize its part that is in the Sphere_3.
In my examples up to now this worked quite well, if only for some annoying problem, I do not know how to overcome: The boundaries, where the implicit surface meets the Sphere, are very "rough" or "jagged" in a more than acceptable amount.
I already tried the 'Manifold_with_boundary_tag()', but it gave no improvements.
One road to improve the output that I am contemplating, is converting the triangulated mesh (a C2t3) into a Polyhedron_3 and this in a Nef_polyhedron and intersect that with a Nef_polyhedron well approximating a slightly smaller Sphere. But this seems a bit like shooting with cannons for sparrows, nevertheless I have currently no better idea and googling gave me also no hint. So my question: What to do about this problem? Can it be done with CGAL (and moderate programming effort) or is it necessary or better to use another system?
(Just for explanation for what I need this: I try to develop a program that constructs 3D-printable models of algebraic surfaces and having a smooth and also in the boundaries smooth triangulation is my last step that is missing before I can hand the surface over to OpenSCAD to generate a solid body of constant thickness).
The only solution I see is to use the 3D Mesh Generation with sharp feature preservation and no criteria on the cells. You will have to provide the intersection of the bounding sphere with the surface yourself.
There is one example with two intersecting spheres in the user manual.

Removing the Water Tight-ness property from the mesh constructed by poisson reconstruction using Point Cloud Library

I would like to generate visually appealing surface reconstruction from the the point clouds.
I am using point cloud library. I tried creating a mesh using poisson reconstruction method but later found that it gives a water tight reconstruction.
For example: In my case I have a point cloud of a room
Using the code at http://justpaste.it/code1 , I was able to get a reconstruction like this
(source: pcl-users.org)
The above picture has the surface which is covering the top view. This was visualized using MeshLab.
Then later on the MeshLab GUI when I press points, it looks like this.
(source: pcl-users.org)
But in the second picture there are points on its surface too(Not clearly visible in the attached picture).
Can you help in creating a model that has no points on the top and just has the inside structure ?
Any other suggestions to improve the reconstruction quality ?
The point cloud of the room and generated ply file can be downloaded from https://dl.dropboxusercontent.com/u/95042389/temp_pcd_ply_files.tar.bz2
One solution that works for me is obtaining a convex/concave hull of your point cloud. Then you can use this hull to filter/crop your mesh after Poisson reconstruction. If you use the PCL you can try ConvexHull or ConcaveHull together with CropHull and test the results. Hope this solves your issue, it did for me.
As far as my experience is concerned (meshing caves), meshing with Poisson will result in watertight model/mesh, which is why your model was covered entirely. I only deal with meshes using MeshLab but I am guessing it is the same thing. What I did try is using Ball-Pivoting meshing algorithm in MeshLab which result in non-watertight model. Maybe that is what you are looking for.