/ concept-collection / numbl-distmesh
Sign in
concept-collection / numbl-distmesh
numbl-distmesh / ex09_torus.m
13 lines · 488 BBlameHistoryRaw
1% ex09_torus.m — Uniform mesh on a torus.
2%
3% The torus is the zero level set of the quartic distance-like function
4% below (major radius 0.8, minor radius 0.2). The bounding box is flat in
5% z because the torus is thin in that direction.
7mip load --install distmesh
9fd=@(p) (sum(p.^2,2)+.8^2-.2^2).^2-4*.8^2*(p(:,1).^2+p(:,2).^2);
10[p,t]=distmeshsurface(fd,@huniform,0.1,[-1.1,-1.1,-.25;1.1,1.1,.25]);
12title('Torus');
13fprintf('mesh: %d nodes, %d triangles\n', size(p,1), size(t,1));
moveopenescclose