- /
-
Diamond
on 20 Oct 2021
- 42
- 57
- 0
- 0
- 278
% Draw circle
t=linspace(0,2*pi,500) ;
R=.5;
xc=R^2*sin(t);
yc=R^2*cos(t);
% Generate random numbers
m=5000;
x=rand(m,1);y=rand(m,1);
% Get random points inside the circle
i=inpolygon(x,y,xc,yc);
x=x(i);y=y(i);
% Generate delaunay
d=delaunayTriangulation(x,y);
z=rand(nnz(i),3);
% plot
figure('color','w')
patch('faces',d.ConnectivityList,'vertices',d.Points,'facevertexc',z)
shading faceted
axis equal off