Create surface consisting of two implicitly surfaces

2 views (last 30 days)
Dear Community,
I would like to create surfaces consisting of two implicitly described surfaces (see figure).
With the functions isosurface and isocaps I only manage to create a full body (see figure).
So far, I have to create two separate full bodies and then subtract them in another program by boolean subtract. Unfortunately, this route is complex and only works to a limited extent. Therefore, I would like to be able to use Matlab to create the surface limited by two implicit surfaces and the edge surfaces.
To create the stl-files I use as code (Note: This requires the stlwrite.m function):
clc
clear
close all
n=200;
t=pi/n;
x_max=1;
y_max=1;
z_max=1;
xi = 0:t:x_max;
yi = 0:t:y_max;
zi = 0:t:z_max;
[x,y,z] = meshgrid(xi,yi,zi);
F=-1.*(cos(2.*pi.*x)+cos(2.*pi.*y)+cos(2.*pi.*z))+0;
[fs,v]=isosurface(x,y,z,F,0);
[fc,v2,c] = isocaps(x,y,z,F,0);
fn = [fs ; fc+length(v(:,1))];
vn = [v ; v2];
stlwrite('geometry.stl',fn,vn);
Can anyone help me with this question?
Thank you very much and best regards

Accepted Answer

Bruno Luong
Bruno Luong on 11 Aug 2020
"Can anyone help me with this question?"
Not clear to me what exactly is the question.
If you have two implicit equations for two surfaces F1==c1 and F2==c2, you might combine the surfaces of both by
(F1-c1).*(F2-c2) == 0.
  1 Comment
Fabian Günther
Fabian Günther on 11 Aug 2020
Wonderful, your proposal works exactly as I imagined it would.
It was not clear to me that I can unite the two surfaces by multiplying them.
Thanks alot Mr. Luong.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!