-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
From 2D to 3D #5
Comments
First, I must remember that this implementation is done with didactic purposes. If you really need to use 3D triangulation (a better name is 3D tetrahedralization), consider using scipy.spatial.Delaunay. If you really want to learn how to implement 3D Delaunay, then go ahead. First consideration is that in 3D you don't work with triangles, but with tetrahedrons (or simplex in 3D), so some code that in 2D is as simple as: # Create two CCW triangles for the frame
T1 = (0, 1, 3)
T2 = (2, 3, 1) must be rewritten as something quite more complex, like: # Create five tetrahedrons for the cubic frame
T1 = (1, 7, 4, 2)
T2 = (1, 4, 7, 5)
T3 = (1, 2, 4, 0)
T4 = (1, 2, 7, 3)
T5 = (7, 2, 4, 6) Where the indexes come from the tetrahedralization of cubic initial frame. The line in 2D code: boundary.append((T[(edge+1) % 3], T[(edge-1) % 3], tri_op)) Can be interpreted as: Insert a tuple formed by one edge and the index of its opposite triangle in the boundary. In the 3D approach, you have to insert a new triangle (instead edge) using the three vertices that are not the "edge" position, sorted in the opposite orientation that in the current tetrahedron, and the index of the opposite tetrahedron (instead triangle) in the boundary. This can be coded as: boundary.append((T[(edge+1) % 4], T[(edge-1) % 4], T[(edge+2) % 4], tetra_op)) Anyway, you are going to run into more problems just after this line, because there is not an easy way to «Check if boundary is a closed loop» as easy as done in 2D. |
Terrific answer! |
I will let to others to judge if it easy or not to implement the multidimensional version of Bowyer-Watson algorithm because that depends of your experience in programming geometry algorithms and «understand dimensions beyond 3D». The «Check if boundary is a closed loop» part can be avoided if you just iterate every triangle//tetrahedron in the This kind of complexity problems going to upper dimensions make the algorithm being not-so-didactic. Most people just can't imagine one «star-shaped hole in space being filled with tetrahedrons, while maintaining the coherence of orientation of the boundary». Also... Could you share why you can't use scipy.spatial.Delaunay or QHull libraries? You can email me if you prefer to keep your reasons private. |
That's very useful so thank you very much for you comments. I will take your thoughts into account and do some more research before would I go further. "Most people just can't imagine one «star-shaped hole in space being filled with tetrahedrons, while maintaining the coherence of orientation of the boundary»".That's definitely true... |
Hi
I'm want to create Delaunay triangulation in 3D.
I find your implementation interesting.
Have you been giving any thought on what this line could look like in 3D:
boundary.append((T[(edge+1) % 3], T[(edge-1) % 3], tri_op))?
The text was updated successfully, but these errors were encountered: