Surface Texturing
Ältere Kommentare anzeigen
I want to create a square surface with circular dimples on it. Circular dimples are like cylinders in which depth, radius, distance from one dimple to another should be variables. Like a chess board but instead of squares in want circles and instead of 2D i want 3D and I want to control the distance between each cylinders. Can anyone please help me out on this
Antworten (1)
Teja Muppirala
am 1 Mai 2011
This is not as difficult as you think. You can use the following code as a starting point. Once you understand why it works, then modify it to fit your needs.
xmin = -100;
xmax = 100;
[X,Y] = meshgrid(xmin:xmax);
ctrs = linspace(xmin,xmax,5);
M = ones(size(X));
for Xctr = ctrs(2:end-1)
for Yctr = ctrs(2:end-1)
R2 = (X-Xctr).^2 + (Y-Yctr).^2;
M = M - (R2 <= 20^2);
end
end
h = surf(M);
zlim([-40 40])
set(h,'facecolor','none');
axis vis3d
zoom(3)
1 Kommentar
Bhushan Patil
am 4 Jan. 2021
Bearbeitet: Bhushan Patil
am 4 Jan. 2021
from the starting of FOR loop i can't understand pls some one help me!
Kategorien
Mehr zu Assembly finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!