Calculate a level-set function for the union of the sets described by the argument level-set functions.
See also: ls_complement, ls_intersect, ls_setdiff, ls_setxor, union.
The following code
n = 100; x = linspace (-7, 7, n); [XX, YY] = meshgrid (x, x); phi1 = (XX - 2 * cos (7/6 * pi)).^2 + (YY - 2 * sin (7/6 * pi)).^2 - 3^2; phi2 = (XX - 2 * cos (11/6 * pi)).^2 + (YY - 2 * sin (11/6 * pi)).^2 - 3^2; phi3 = XX.^2 + (YY - 2).^2 - 3^2; phi = ls_union (phi1, phi2, phi3); figure (); subplot (1, 2, 1); hold ("on"); contour (XX, YY, phi1, [0, 0], "k"); contour (XX, YY, phi2, [0, 0], "k"); contour (XX, YY, phi3, [0, 0], "k"); hold ("off"); axis ("equal"); subplot (1, 2, 2); hold ("on"); imagesc (x, x, phi); set (gca (), "ydir", "normal"); ls_sign_colourmap (); contour (XX, YY, phi, [0, 0], "k"); hold ("off"); axis ("equal");
Produces the following figure
Figure 1 |
---|
Package: level-set