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!