isosurface with wall thickness

15 views (last 30 days)
Carolin Widmann
Carolin Widmann on 28 Jul 2021
Commented: Star Strider on 1 Aug 2021
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;

Answers (2)

darova
darova on 29 Jul 2021
What abouy simply to make thicker a lines?
[x,y,z] = peaks(30);
surf(x,y,z,'linewidth',3)

Star Strider
Star Strider on 29 Jul 2021
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');
ISOSURFACE: Computing triangles and vertices... V-done ...................................... ISOSURFACE: number of vertices=38951 number of triangles=75580
d = x_period/(2*(x_period*frequency/pi)) - 0.1;
toc;
Elapsed time is 3.183315 seconds.
.
  2 Comments
Carolin Widmann
Carolin Widmann on 1 Aug 2021
Hi thanks for your answer!
Is there the possibility to connect both versions, so that it looks like one in the end?
Best regards!
Star Strider
Star Strider on 1 Aug 2021
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
xfk = 0.9900
xfk = 0.9910
xfk = 0.9920
xfk = 0.9930
xfk = 0.9940
xfk = 0.9950
xfk = 0.9960
xfk = 0.9970
xfk = 0.9980
xfk = 0.9990
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;
Elapsed time is 4.311571 seconds.
Experiment with it to get the result you want.
.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!