How to remove triangles in a hollow hemisphere shape?
Show older comments
So I have this code where I am designing a hollow hemispherical shape and I want to create a 3D volume to input it into FEBio software.

I am using delaunay triangulation for meshing. But the problem is when I rotate to see the bottom, I am seeing is that there are triangles there of this 3D model as shown below:

How do I remove these triangles that are connected at the bottom? I want to triangles only on the surface of the inner and outer hemispheres and between them.
clear
clc
outerRadius = 7.8; % Outer radius of the hemisphere
innerRadius = 7.3; % Inner radius of the hollow region
theta = linspace(0, pi/2, 100);
phi = linspace(0, 2*pi, 100);
[THETA, PHI] = meshgrid(theta, phi);
% Calculate the coordinates for the outer hemisphere
X_outer = outerRadius * cos(PHI) .* sin(THETA);
Y_outer = outerRadius * sin(PHI) .* sin(THETA);
Z_outer = outerRadius * cos(THETA);
% Calculate the coordinates for the inner hemisphere
X_inner = innerRadius * cos(PHI) .* sin(THETA);
Y_inner = innerRadius * sin(PHI) .* sin(THETA);
Z_inner = innerRadius * cos(THETA);
X = [X_outer(:); X_inner(:)];
Y = [Y_outer(:); Y_inner(:)];
Z = [Z_outer(:); Z_inner(:)];
% Combine the coordinates of the outer and inner hemispheres
points = [X, Y, Z];
% Remove duplicate points
[~, uniqueIndices, ~] = unique(points, 'rows', 'stable');
points = points(uniqueIndices, :);
% Separate the updated coordinates
X = points(:, 1);
Y = points(:, 2);
Z = points(:, 3);
% Generate the triangulated mesh
tri = delaunay(X, Y, Z);
% Plot the mesh
figure; set(gcf,'WindowState','maximized');
trimesh(tri, X, Y, Z);
xlabel('X'); ylabel('Y'); zlabel('Z');
title('Triangulated Mesh');
Accepted Answer
More Answers (0)
Categories
Find more on Triangulations 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!
