tetrahedrizing a mesh - mesh

I am looking for an algorithm that receives a 3d surface mesh (i.e comprised of 3d triangles that are a discretization of some manifold) and generates tetrahedra inside the mesh's volume.
i.e, I want the 3d equivalent to this 2d problem: given a closed curve, triangulate it's interior.
I am sorry if this is unclear, it's the best way I could think of explaining it.
For the 2d case there's Triangle. For a 3d case I could find none.

pygalmesh (a project of mine based on CGAL) can do just that.
pygalmesh-volume-from-surface elephant.vtu out.vtk --cell-size 1.0 --odt
https://github.com/nschloe/pygalmesh/#volume-meshes-from-surface-meshes

I found GRUMMP which seems to answer all the needs mentioned in the question, and more...

I haven't had any experience using GRUMMP, but as far as a 3D version of triangle there is tetgen. If you know the triangle switches it is built to resemble it. It also has fairly decent documentation and a python wrapper for it and triangle.
http://wias-berlin.de/software/tetgen/
http://mathema.tician.de/software/meshpy/

Related

2D shape detection in 3D pointcloud

I'm working on a project to detect the position and orientation of a paper plane.
To collect the data, I'm using an Intel Realsense D435, which gives me accurate, clean depth data to work with.
Now I arrived at the problem of detecting the 2D paper plane silhouette from the 3D point cloud data.
Here is an example of the data (I put the plane on a stick for testing, this will not be in the final implementation):
https://i.stack.imgur.com/EHaEr.gif
Basically, I have:
A 3D point cloud with points on the plane
A 2D shape of the plane
I would like to calculate what rotations/translations are needed to align the 2D shape to the 3D point cloud as accurate as possible.
I've searched online, but couldn't find a good way to do it. One way would be to use Iterative Closest Point (ICP) to first take a calibration pointcloud of the plane in a known orientation, and align it with the current orientation. But from what I've heard, ICP doesn't perform well if the pointclouds aren't kind of already closely aligned at the start.
Any help is appreciated! Coding language doesn't matter.
Does your 3d point cloud have outliers? How many in what way?
How did you use ICP exactly?
One way would be using ICP, with a hand-crafted initial guess using
pcl::transformPointCloud (*cloud_in, *cloud_icp, transformation_matrix);
(to mitigate the problem that ICP needs to be close to work.)
What you actually want is the plane-model that describes the position and orientation of your point-cloud right?
A good estimator of your underlying function can be found with: pcl::ransac
pcl::ransace model consensus
You can then get the computedModel coefficents.
Now finding the correct transformation is just: How to calculate transformation matrix from one plane to another?

Make 3D figure of 2D images "projecting information" onto each other

Is there a way to make a z-stack of 2-D images, at the isometric view in 3-D, of points in each 2-D image projecting downwards to the next slice of 2-D images? I am certain there is a technical term for this, but I just don't have the vocabulary to find the most pertinent answer. Would someone be able to point me in the right direction?
Below, I've drawn an "idea" of what this looks like. I'd love to know if this is possible without re-inventing wheels for matplotlib or other Python plotting libraries.
The original question was posed for doing so in Python. After many months of searching, I found a way to do so in TikZ. I cannot consider this my original work, it is largely based on Pascal Seppecher's interaction diagram found here.
To reconstitute my question above, one can use the above template to define:
Agents of different shapes, specify fills
The frame (plane)
which they reside in
Flows of directed edges that communicate
how agents interact with each other in each plane
Inter-plane
interaction flows
https://texample.net/tikz/examples/interaction-diagram/

determine camera rotation and translation matrix from essential matrix

I am trying to extract rotation matrix and translation matrix from essential matrix.
I took these answers as reference:
Correct way to extract Translation from Essential Matrix through SVD
Extract Translation and Rotation from Fundamental Matrix
Now I've done the above steps applying SVD to essential matrix, but here comes the problem. According to my understanding about this subject, both R and T has two answers, which leads to 4 possible solutions of [R|T]. However only one of the solutions would fit in the physical situation.
My question is how can I determine which one of the 4 solutions is the correct one?
I am just a beginner on studying camera position. So if possible, please make the answer be as clear (but simple) as possible. Any suggestion would be appreciated, thanks.
The simplest is testing a point 3D position using the possible solution, that is, a reconstructed point will be in front of both cameras in only one of the possible 4 solutions.
So assuming one camera matrix is P = [I|0], you have 4 options for the other camera, but only one of the pairs will place such point in front them.
More details in Hartley and Zisserman's multiple view geometry (page 259)
If you can use Opencv (version 3.0+), you count with a function called "recoverPose", this function will do that job for you.
Ref: OpenCV documentation, http://docs.opencv.org/trunk/modules/calib3d/doc/calib3d.html

Triangulate a surface with vtk from points AND normals

I have a set of points in 3D that lie on a surface and I also have the normals at every point.
I would like to generate a surface triangulation with this information. In addition I could tell the algorithm to use what points lie on the boundary if that is needed.
So, I have quite a bit of information:
* points
* normals
* boundary
How do I triangulate a surface with this information using vtk?
A surface reconstruction algorithm is like using a bomb for this problem since I have all this information that I would like to use. This information comes from a simulation so I know the surface exists and that is quite smooth.
I would like the answer to be cast in terms of either what vtk function to use and if available (and that would be great) examples using this function.
Thank you so much in advance.
You can use the vtkSurfaceReconstruction filter to create a surface from a set of 3D points.
You could try the point cloud library
Point Cloud Library
Just the 3D points would be good enough. Since you know that your surface is smooth, you can perform a Delaunay triangulation of the points (vtkDelaunay3D) and apply a subdivision filter for smoothening (vtkButterflySubdivisionFilter).
Delaunay3D triangulation

How is a 3d perlin noise function used to generate terrain?

I can wrap my head around using a 2D Perlin noise function to generate the height value but I don't understand why a 3D Perlin noise function would be used. In Notch's blog, he mentioned using a 3D Perlin noise function for the terrain generation on Minecraft. Does anyone know how that would be done and why it would be useful? If you are passing x, y, and z values doesn't that imply you already have the height?
The article says exactly why he used 3D noise:
I used a 2D Perlin noise heightmap...
...but the disadvantage of being rather
dull. Specifically, there’s no way for
this method to generate any overhangs.
So I switched the system over into a
similar system based off 3D Perlin
noise. Instead of sampling the “ground
height”, I treated the noise value as
the “density”, where anything lower
than 0 would be air, and anything
higher than or equal to 0 would be
ground.
Well, Minecraft is about Mines. So, what Notch tried to solve was: "How do I get holes / overhangs in my world?"
Since 2D perlin noise generates nice/smooth looking hills, 3d perlin noise will generate nice/smooth hills and nice holes in your 3D voxel grid.
An implementation can be found here (while that is an N-dimensional solution).
In other use-cases the Z component of a 3D perlin noise is set to the current time. This way you will get a smooth transition between different 2d perlin noises and that can be used as groundwork for fluid textures.
You should look at the Minetest source, specifically at the files noise.cpp and map.cpp.
If you are still confused, I actually had the same question and figured it out and made perhaps the only tutorial video on the subject on YouTube as a whole!
My Video Explaining 3D Perlin Noise:
https://youtu.be/plLVPJJCL8w