Building cylinder using isosurface
3 次查看(过去 30 天)
显示 更早的评论
Hello everyone,
I'm trying to create a cylindric patch using the isosurface command. Using this tutorial I created my own structure. The code is the following:
[x,y,z] = meshgrid(-1:.02:1);
blob = z <= 0 & z >= -1 & x.^2 + y.^2 <= sqrt(0.18) & x.^2 + y.^2 >= sqrt(0.15);
p = patch(isosurface(blob,0.5));
set(p, 'FaceColor', 'red', 'EdgeColor', 'none');
view(3)
camlight
alpha(0.3)
lighting gouraud
Now, I want to specify for every level of the cylinder a different radius. The values of the radii for every level are stored in a vector 1x36.
How can I modify the blob accordingly?
Thanks for any suggestions.
0 个评论
采纳的回答
Matz Johansson Bergström
2014-7-29
I would try using a function
test = @(x) abs( cos(4*x) );
[x,y,z] = meshgrid(-1:.02:1);
blob = z <= 0 & z >= -1 & x.^2 + y.^2 <= ...
sqrt(0.18*test(z)) & x.^2 + y.^2 >= ...
sqrt(0.12*test(z));
In this way you will get a wobbly thing depending on the z coordinate.
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!