finding fold curve in 3D surface
3 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I have a 3D surface. Could you please tell me how can I plot the fold curve for it and coulour differently upper and bottom sheet?
here is the code for plotting the surface with its picture.
Thanks in advance for any help.
clear all
vplc=0.15;
delta=0.1;
Ktau=0.045;
Kc=0.1;
e=0.002;
K=0.000015/e
Kp=0.15;
gamma=5.5;
kb=0.4;
Vs=0.002;
vss=Vs./(e).^(1/2)
v_pm=delta.*0.000159/(e);
alpha0=delta*6.81e-6/(e);;
alpha1=delta*2.27e-5/(e)
Ke=7;
ks=0.1;
Kf=0.18;
kplc=0.055;
ki=2;
[C,ct]=meshgrid(0:0.001:2);
c=C;
p=(vplc./ki).*(e.^(1/2).*c.^2./((kplc).^2+e.^(1/2).*c.^2));
A=(-(vss.*c.^2)./(ks.^2))+((Vs.*K.*gamma.^2.*ct.^2)./(ks.^2))+alpha0+alpha1.*((Ke.^4)./(Ke.^4+(gamma.*ct).^4));
h=-0.4.*A.*((Kc.^4).*(Kp.^2))./((p.^2.*c.^4.*gamma.*ct.*Kf));
s=surf(ct,h,c);
s.EdgeColor = 'none';
s.FaceLighting = 'gouraud';
s.FaceAlpha=0.5;
xlabel('ct')
ylabel('h')
zlabel('c')
xlim([0 1.25])
ylim([0.2 1])
zlim([0 0.3])
0 件のコメント
採用された回答
John D'Errico
2023 年 2 月 4 日
編集済み: John D'Errico
2023 年 2 月 4 日
You have a surface, generated using meshgrid. I would split that surface into a triangulated mesh. So two triangles per rect in the mesh. Next, for each triangle in the triangulation, I would now generate a normal vector to the surface, using the function cross. Test which direction that normal vector points, up or down. Essentially, you will just use the z-component of the surface normal. Color the surface depending on the direction identified by the normal vector. Simple.
For example, a simple paraboloid of revolution.
[t,x] = meshgrid(linspace(0,2*pi),linspace(0,10,50));
y = sqrt(x).*cos(t);
z = sqrt(x).*sin(t);
% triangulate the grid
[m,n] = size(t);
[in,im] = meshgrid(1:n-1,1:m-1);
ind = sub2ind([m,n],im(:),in(:));
tri = [[ind,ind+1,ind+m];[ind+1,ind+m+1,ind+m]];
xyz = [x(:),y(:),z(:)];
normals = cross(xyz(tri(:,2),:) - xyz(tri(:,1),:),xyz(tri(:,3),:) - xyz(tri(:,1),:));
direction = normals(:,3) >= 0;
H1 = trimesh(tri(direction,:),xyz(:,1),xyz(:,2),xyz(:,3));
hold on
H2 = trimesh(tri(~direction,:),xyz(:,1),xyz(:,2),xyz(:,3));
hold off
H1.FaceColor = 'r';
H2.FaceColor = 'b';
H1.EdgeColor = 'none';
H2.EdgeColor = 'none';
I chose a coloring that has faces in the upper branch as blue, those on the lower branch are red.
Actually finding the fold in the curve itself seems, at least initially, a more difficult problem. You could view that as an implicit function to locate the path of a singularity in the surface. As I think though, perhaps simplest is to locate triangles in the triangulation I generated where the triangles share an edge, but the normal vectors point in different directions. The shared edge will delineate an approximate path around the surface of the "fold". As such, it would be quite doable.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Triangulation Representation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!