How to extract sphere from a tetrahedra 3D and meshing the rest???
I went to extract 3D sphere from tetrahedra and meshing the rest i do this code and i have error
fid = fopen(‘nodes10.dat’);
data = fscanf(fid, ‘%g %g %g’, [3, Inf]);
A = data’;
fclose(fid);
A;
n=size(A);
kk=n(1);
R=1.5;
MM=zeros(kk,1);
for k=1:kk
MM(k)=0;
for i=1:3
MM(k)= MM(k)+ A(k,i)*A(k,i);
end
MM(k)=sqrt(MM(k));
end
M = A(MM >R,:);
[x1,y1,z1] = sphere(1);
Psphere = [R*x1(:) R*y1(:) R*z1(:)];
Psphere = unique(Psphere,’rows’);
P = [M;Psphere];
plot3(P(:,1),P(:,2),P(:,3),’.’)
shp= alphaShape(P(:,1),P(:,2),P(:,3),1);
plot(shp)
shp.Alpha = 2;
[tri,loc] = alphaTriangulation(shp);
fid = fopen(‘nodess.dat’,’w’);
fprintf(fid,’%it %it %in’,loc);
fclose(fid);
fid = fopen(‘tetreades.dat’,’w’);
fprintf(fid,’%it %it %it %in’,tri);
fclose(fid);
numtetrahedra = size(tri,1);
numnodes = size(loc);
axis equalI went to extract 3D sphere from tetrahedra and meshing the rest i do this code and i have error
fid = fopen(‘nodes10.dat’);
data = fscanf(fid, ‘%g %g %g’, [3, Inf]);
A = data’;
fclose(fid);
A;
n=size(A);
kk=n(1);
R=1.5;
MM=zeros(kk,1);
for k=1:kk
MM(k)=0;
for i=1:3
MM(k)= MM(k)+ A(k,i)*A(k,i);
end
MM(k)=sqrt(MM(k));
end
M = A(MM >R,:);
[x1,y1,z1] = sphere(1);
Psphere = [R*x1(:) R*y1(:) R*z1(:)];
Psphere = unique(Psphere,’rows’);
P = [M;Psphere];
plot3(P(:,1),P(:,2),P(:,3),’.’)
shp= alphaShape(P(:,1),P(:,2),P(:,3),1);
plot(shp)
shp.Alpha = 2;
[tri,loc] = alphaTriangulation(shp);
fid = fopen(‘nodess.dat’,’w’);
fprintf(fid,’%it %it %in’,loc);
fclose(fid);
fid = fopen(‘tetreades.dat’,’w’);
fprintf(fid,’%it %it %it %in’,tri);
fclose(fid);
numtetrahedra = size(tri,1);
numnodes = size(loc);
axis equal I went to extract 3D sphere from tetrahedra and meshing the rest i do this code and i have error
fid = fopen(‘nodes10.dat’);
data = fscanf(fid, ‘%g %g %g’, [3, Inf]);
A = data’;
fclose(fid);
A;
n=size(A);
kk=n(1);
R=1.5;
MM=zeros(kk,1);
for k=1:kk
MM(k)=0;
for i=1:3
MM(k)= MM(k)+ A(k,i)*A(k,i);
end
MM(k)=sqrt(MM(k));
end
M = A(MM >R,:);
[x1,y1,z1] = sphere(1);
Psphere = [R*x1(:) R*y1(:) R*z1(:)];
Psphere = unique(Psphere,’rows’);
P = [M;Psphere];
plot3(P(:,1),P(:,2),P(:,3),’.’)
shp= alphaShape(P(:,1),P(:,2),P(:,3),1);
plot(shp)
shp.Alpha = 2;
[tri,loc] = alphaTriangulation(shp);
fid = fopen(‘nodess.dat’,’w’);
fprintf(fid,’%it %it %in’,loc);
fclose(fid);
fid = fopen(‘tetreades.dat’,’w’);
fprintf(fid,’%it %it %it %in’,tri);
fclose(fid);
numtetrahedra = size(tri,1);
numnodes = size(loc);
axis equal sphere 3d MATLAB Answers — New Questions