% Example 6: Combine a transformed copy of a star-shaped domain and a % transformed copy of a circle into a single multi-component chunker, with % consistent outward-pointing normals. 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)); % rotate, reflect, and reverse the star chnkr5 = chnkr2; theta = pi/4; chnkr5 = chnkr5.rotate(theta); chnkr5 = chnkr5.reflect(pi/2); chnkr5 = chnkr5.reverse(); % affine-transform the circle and reverse its orientation 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; % merge into one multi-component domain chnkr7 = merge([chnkr5,chnkr6]); toc; figure(5); clf plot(chnkr7,'b-x'); hold on; quiver(chnkr7,'r') axis equal tight