isosurface with wall thickness
15 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I would like to plot a gyroid with a wall thickness.
So far I am using Isosurface to plot the gyroid.
Does anyone know how to add a wall thickness?
I am looking forward to your help!
Thanks!
clear all;
close all;
clc;
tic;
x_period = 3.2*pi;
y_period = 3.2*pi;
z_period = 2.4*pi;
rate = pi/16;%64;
frequency = 2.5;%1.25;
[x,y,z] = meshgrid(0:rate:x_period, 0:rate:y_period, 0:rate:z_period);
f = cos(frequency*x).*sin(frequency*y) + cos(frequency*y).*sin((frequency*z)+pi/2) + cos((frequency*z)+pi/2).*sin(frequency*x);
figure(1)
isosurface(x,y,z,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
hold on
figure(2)
isosurface(x,y,z,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
view(2)
figure(3)
isosurface(x,y,z,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
% view(-45,36)
% view(0,0) % parallel
view(90,0) % perpendicular
% set(gca,'XTickLabel',[],'YTickLabel',[],'ZTickLabel',[]);
% set(gca,'Visible','off')
fv = isosurface(x,y,z,f,'verbose');
d = x_period/(2*(x_period*frequency/pi)) - 0.1;
toc;
0 个评论
回答(2 个)
darova
2021-7-29
What abouy simply to make thicker a lines?
[x,y,z] = peaks(30);
surf(x,y,z,'linewidth',3)
0 个评论
Star Strider
2021-7-29
There does not appear to be any way to change the thickness of the plotted surface.
The best I can come up with is the revised figure(2) that plots two slightly scaled versions of the same surface together, so one is slightly smaller than the other. I only changed that one plot, not the ones following it.
(If that does not do what you want, I will delete my Answer.)
tic;
x_period = 3.2*pi;
y_period = 3.2*pi;
z_period = 2.4*pi;
rate = pi/16;%64;
frequency = 2.5;%1.25;
[x,y,z] = meshgrid(0:rate:x_period, 0:rate:y_period, 0:rate:z_period);
f = cos(frequency*x).*sin(frequency*y) + cos(frequency*y).*sin((frequency*z)+pi/2) + cos((frequency*z)+pi/2).*sin(frequency*x);
figure(1)
isosurface(x,y,z,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
xf = 0.996; % Scaling Factor
figure(2) % Plots Two Scaled Versions Together
isosurface(x*xf,y*xf,z*xf,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
hold on
isosurface(x/xf,y/xf,z/xf,f,0)
hold off
figure(3)
isosurface(x,y,z,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
view(2)
figure(4)
isosurface(x,y,z,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
% view(-45,36)
% view(0,0) % parallel
view(90,0) % perpendicular
% set(gca,'XTickLabel',[],'YTickLabel',[],'ZTickLabel',[]);
% set(gca,'Visible','off')
fv = isosurface(x,y,z,f,'verbose');
d = x_period/(2*(x_period*frequency/pi)) - 0.1;
toc;
.
2 个评论
Star Strider
2021-8-1
My pleasure!
I doubt that is possible. The only option I can think of is to use a loop to gradually fill the gaps simply by drawing the same scaled surface several times.
This is my best effort:
tic;
x_period = 3.2*pi;
y_period = 3.2*pi;
z_period = 2.4*pi;
rate = pi/16;%64;
frequency = 2.5;%1.25;
[x,y,z] = meshgrid(0:rate:x_period, 0:rate:y_period, 0:rate:z_period);
f = cos(frequency*x).*sin(frequency*y) + cos(frequency*y).*sin((frequency*z)+pi/2) + cos((frequency*z)+pi/2).*sin(frequency*x);
figure(1)
isosurface(x,y,z,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
xf = 0.99; % Scaling Factor
figure(2) % Plots Two Scaled Versions Together
isosurface(x*xf,y*xf,z*xf,f,0)
axis equal
xlabel('X')
ylabel('Y')
zlabel('Z')
hold on
for k = 1:10
xfk = xf+((k-1)*(1-xf)/10)
isosurface(x/xfk,y/xfk,z/xfk,f,0)
end
hold off
% figure(3)
% isosurface(x,y,z,f,0)
% axis equal
% xlabel('X')
% ylabel('Y')
% zlabel('Z')
% view(2)
%
% figure(4)
% isosurface(x,y,z,f,0)
% axis equal
% xlabel('X')
% ylabel('Y')
% zlabel('Z')
% % view(-45,36)
% % view(0,0) % parallel
% view(90,0) % perpendicular
% % set(gca,'XTickLabel',[],'YTickLabel',[],'ZTickLabel',[]);
% % set(gca,'Visible','off')
% fv = isosurface(x,y,z,f,'verbose');
%
% d = x_period/(2*(x_period*frequency/pi)) - 0.1;
toc;
Experiment with it to get the result you want.
.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!