Triangulation of hollow objects

19 views (last 30 days)
Tero
Tero on 8 Jan 2021
Commented: Tero on 1 Oct 2025 at 10:22
Hi all,
simply, how to make the simple hollow 3D triangle depicted below?
Is there some contraint method I could use instead? I use the following command to get the surface:
tri = triangulation(delaunay(x,y),x,y,z);

Accepted Answer

DGM
DGM on 1 Oct 2025 at 9:31
The usage of delaunay() here isn't going to work for a few reasons. First, you're triangulating the projection of the part into the x,y plane. You lose any information which suggests that it forms any sort of closed shape. It's a sheet.
Even if you rotated the part so that the projection was an unambiguous B shape, there are two more problems. First is that the 2D projection is nonconvex. Normally, you handle nonconvex cases by defining constraint curves, but in this case, the curve as drawn isn't valid. It has a vertex which splits an edge.
You could split the long face, but delaunay() is still going to complain about these duplications. Self-tangency is usually a problem.
In this case, the model is simple enough that we don't need to use delaunay() anyway. If this is truly the thing we want, just work it out. The open end faces are trivial. We don't need to triangulate them at all. The only thing left is the self-tangent ribbon shape which forms the loop. That's just diagonally-subdivided quads.
For sake of simplicity, I'm going to orient the part along z (as indicated in the diagrams) so that I can treat this like I do in other examples.
% start in 2D (x,y)
% construct vertices in a CCW path around the edge of the ribbon
zr = [-0.7 0.7]; % we'll need this later
V = [-1 0.5; -0.5 0; 0 0.5; 0.5 0; 1 0.5; 0 0.5];
% expand the short list of vertices in 2D in order to
% construct vertices in 3D for both the top and bottom of the ribbon
nverts = size(V,1);
V = [V zr(1)*ones(nverts,1); V zr(2)*ones(nverts,1)];
% construct the face list that forms the ribbon
va = (1:nverts).'; % top
vb = va + nverts; % bottom
vc = circshift(va,-1); % top
vd = vc + nverts; % bottom
F = [va vb vc; vd vc vb];
% permute the axes to reorient the part as requested
V = V(:,[1 3 2]);
% display it using patch()
patch('faces',F,'vertices',V, ...
'facecolor',[1 1 1]*0.9,'edgecolor','k');
view(3); camlight; view(12,7); axis equal; grid on
xlabel('X'); ylabel('Y'); zlabel('Z')
Again, I suspect that this probably would have still been a problematic model, but I don't know what the purpose was. If it needed to be closed, then I would have done this differently.
  1 Comment
Tero
Tero on 1 Oct 2025 at 10:22
Hey,
thanks a lot for coming back to this older topic. It's a bit in the past already, but I'm always happy to get replies!
I was originally requesting triangulation because I was using the ray-triangle intersection in GPU processes: https://se.mathworks.com/matlabcentral/fileexchange/49670-hardware-accelerated-ray-triangle-intersection
Otherwise splitting the triangles in two should not be a problem

Sign in to comment.

More Answers (1)

AKennedy
AKennedy on 5 Jun 2024
Hi Tero,
Here are two possible approaches to create a hollow 3D triangle in MATLAB:
  1. Using the "patch" function: This function allows you to define a 3D surface using vertices, colors, and transparency. You can create separate surface patches for the outer shell and the inner shell of the triangle, specifying transparency for the inner shell to make it hollow.
  2. Using implicit functions: You can define the geometry of the hollow triangle using implicit functions. An implicit function defines a shape based on a mathematical equation where all points satisfying the equation are considered inside the shape. By combining two implicit functions, one for the outer shell and another for the inner shell, you can create the desired hollow shape.
Here are some resources that you might find helpful: https://www.mathworks.com/help/matlab/ref/patch.html
  1 Comment
DGM
DGM on 1 Oct 2025 at 8:49
This doesn't answer the question at all. The question asks how to do the triangulation.
Recommending patch() is pointless since OP has nothing to draw until they get the mesh triangulated. Besides that, we can see that they are already able to do the plotting.
Why would it make sense to try to derive a set of implicit equations to describe an arbitrary triangulated mesh? Even if it made sense in this scenario, that's about like just saying "use an algorithm". It's comically unhelpful.

Sign in to comment.

Categories

Find more on Triangulation Representation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!