There are three arbitrary curves that defined by three implicit functions. How to separate the 12 regions(one of them is the outside infinite region)
Although we can use image methods to distinguish it, the effect seem not so good. Here we want to get the vector graphics. Thanks!
curves = ContourPlot[{x^2 + y^2 - 16 == 0,
x^2/36 + y^2 == 1, (x - 2)^2 + (y + 1)^2 - 9 == 0}, {x, -7,
7}, {y, -7, 7},
ContourStyle -> Directive[AbsoluteThickness[2], Black],PlotRangePadding -> None]
Colorize[MorphologicalComponents[curves]]
Test another way.(I don't know how to extract data from BoundaryMeshRegion
directly.)
Clear["Global`*"];
curves = ContourPlot[{x^2 + y^2 - 16 == 0,
x^2/36 + y^2 == 1, (x - 2)^2 + (y + 1)^2 - 9 == 0}, {x, -7,
7}, {y, -7, 7},
ContourStyle -> Directive[AbsoluteThickness[2], Black],
Frame -> False,PlotRangePadding -> None];
Colorize[MorphologicalComponents[curves]];
domains = ImageMesh[curves, Method -> "DualMarchingSquares"];
pts = MeshCoordinates[domains];
lines = MeshCells[domains, "Multicells" -> True][[2]];
regs = BoundaryMeshRegion[pts, #] & /@ lines;
outside = BoundaryMeshRegion[pts, lines[[1]], lines[[2]]];
insides =
BoundaryMeshRegion[pts, lines[[#]]] & /@ Range[3, Length[regs]];
Graphics[{Gray, outside,
Thread[{ColorData[96] /@ Range[Length[regs] - 2], insides}]}]
A, B, C
useImplicitRegion
for each of your equations. $\endgroup$curves = ContourPlot[{x^2 + y^2 - 16 == 0, x^2/36 + y^2 == 1, (x - 2)^2 + (y + 1)^2 - 9 == 0}, {x, -7, 7}, {y, -7, 7}, PlotRangePadding -> None, Frame -> False]; ArrayPlot[MorphologicalComponents[curves, .9], ColorRules -> {0 -> White, 1 -> Green, 2 -> Red, 3 -> Blue, 4 -> Yellow, 5 -> Cyan, 6 -> Orange, 7 -> Brown, 8 -> Pink, 9 -> Purple, 10 -> Magenta, 11 -> Gray, 12 -> LightYellow}]
$\endgroup$curves = ContourPlot[{x^2 + y^2 - 16 == 0, x^2/36 + y^2 == 1, (x - 2)^2 + (y + 1)^2 - 9 == 0}, {x, -7, 7}, {y, -7, 7}, PlotRangePadding -> None, Frame -> False]; regs = ConnectedMeshComponents[ ImageMesh[curves, Method -> "DualMarchingSquares"]]; Graphics[Thread[{ColorData[97] /@ Range[Length[regs]], regs}]]
$\endgroup$