% Example 7: Find the points on the interior of a (multi-component) % chunker domain using chunkerinterior, and visualize them. mip load --install magland/magland/chunkie; tic; % recreate the circle (chnkr1) rad = 2; ctr = [1.0;-0.5]; circfun = @(t) ctr + rad*[cos(t(:).');sin(t(:).')]; chnkr1 = chunkerfunc(circfun); % recreate the random-mode star (chnkr2) rng(0) modes = randn(11,1); modes(1) = 1.1*sum(abs(modes(2:end))); ctr2 = [1.0;-0.5]; chnkr2 = chunkerfunc(@(t) chnk.curves.bymode(t,modes,ctr2)); % rebuild the merged domain (chnkr7) chnkr5 = chnkr2; chnkr5 = chnkr5.rotate(pi/4); chnkr5 = chnkr5.reflect(pi/2); chnkr5 = chnkr5.reverse(); chnkr6 = chnkr1; A = 0.5*[2 -1; 1 1]; r1 = [-1;0.5]; chnkr6 = r1 + A*chnkr6; chnkr6 = chnkr6.reverse(); % recenter the circle inside the star and scale it down so it fits mins5 = min(chnkr5); maxs5 = max(chnkr5); mins6 = min(chnkr6); maxs6 = max(chnkr6); ctr5 = 0.5*(mins5+maxs5); ctr6 = 0.5*(mins6+maxs6); ext5 = min(maxs5 - mins5); ext6 = max(maxs6 - mins6); scale = 0.3*ext5/ext6; chnkr6 = chnkr6 + (-ctr6); chnkr6 = scale*chnkr6; chnkr6 = chnkr6 + ctr5; chnkr7 = merge([chnkr5,chnkr6]); % grid of test points mins = min(chnkr7); maxs = max(chnkr7); x1 = linspace(mins(1),maxs(1)); y1 = linspace(mins(2),maxs(2)); [xx,yy] = meshgrid(x1,y1); pts = [xx(:).'; yy(:).']; % interior test in = chunkerinterior(chnkr7,pts); zz = nan(size(xx)); zz(in) = 1; toc; figure(6) h = pcolor(xx,yy,zz); set(h,'EdgeColor','none'); axis equal tight