# How can I create a Delanay point in a cube?

4 vues (au cours des 30 derniers jours)
Chenglin Li le 30 Juil 2022
Commenté : Chenglin Li le 3 Août 2022
I want to generate Mesh for a cube,but the points inside the cube can only be regularly distributed so far, and I want the surface and volume meshes to be regular triangles and regular tetrahedra.Matlab only. What do I need to do?
I would appreciate some help :)
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponse acceptée

Bruno Luong le 30 Juil 2022
Modifié(e) : Bruno Luong le 30 Juil 2022
A cube can be devided in 6 tetrahedra
nx=4;
ny=3;
nz=2;
grid = arrayfun(@(n)linspace(0,n,n+1),[nx,ny,nz], 'unif', 0);
[grid{:}] = ndgrid(grid{:});
grid = cat(4,grid{:});
grid = reshape(grid,[],3);
Tcube = [...
5, 1, 3, 2;
7, 5, 3, 2;
7, 6, 5, 2;
7, 4, 6, 2;
7, 3, 4, 2;
7, 8, 6, 4];
[Tx, Ty, Tz]=ind2sub([2 2 2],Tcube);
Tx = Tx-1;
Ty = Ty-1;
Tz = Tz-1;
C = zeros([nx,ny,nz,size(Tcube)]);
for k=1:nz
for j=1:ny
for i=1:nx
Cijk = sub2ind([nx,ny,nz]+1,i+Tx,j+Ty,k+Tz);
C(i,j,k,:,:) = reshape(Cijk,[1,1,1,size(Tcube)]);
end
end
end
C = reshape(C, [], 4);
TR = triangulation(C,grid);
% Graphical plot
patch('Faces', TR.ConnectivityList, 'Vertices', TR.Points,'FaceColor', 'g', 'FaceAlpha', 0.5);
view(3);
axis equal
##### 7 commentairesAfficher 5 commentaires plus anciensMasquer 5 commentaires plus anciens
Bruno Luong le 3 Août 2022
Modifié(e) : Bruno Luong le 3 Août 2022
You always speak about "triangles" as if you want to mesh the surface and not the volume.
In 2D this FileExchange gives very doof result.
Chenglin Li le 3 Août 2022
I have seen this 2D program and it works very well，but I still want to generate regular tetrahedral volume mesh in 3D, but the grid points in the volume are not clear how to generate.

Connectez-vous pour commenter.

### Plus de réponses (1)

Shivam le 30 Juil 2022
To triangulate a 3D point cloud you need the BallPivoting algorithm:
https://vgc.poly.edu/~csilva/papers/tvcg99.pdf
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Chenglin Li le 1 Août 2022
Thanks,is there a similar MATLAB program, I want to see how it is generated from the program.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Geometry and Mesh dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by