3

From 2016 and Version 11.0 we can use ImageMesh. img = ImagePad[ColorNegate@Image@Graphics[Polygon[shape]], 30]; imgD = Dilation[img, DiskMatrix[30]]; mesh0 = ImageMesh@img; meshD = ImageMesh@imgD; Graphics[{Green, Arrow[Flatten[pts0 = MeshPrimitives[mesh0, 1][[All, 1]], 1]], Red, Arrow@Flatten[ptsD = MeshPrimitives[meshD, 1][[All, 1]], 1]}]


2

shape = First @ CountryData["Chad", "Coordinates"]; poly = Polygon @ shape; srd = SignedRegionDistance @ poly; ranges = Flatten /@ Transpose[{{x, y}, CoordinateBounds[ScalingTransform[1.4 {1, 1}, Mean @ shape] @ shape]}]; ContourPlot[srd[{x, y}], ranges[[1]], ranges[[2]], Contours -> Thread[{{-1, -.5, -.25, .25, .5, 1}, ...


2

As of V12 we can use SimplePolygonQ: SeedRandom[0]; n = 10; p = RandomReal[1.0, {n, 2}]; Graphics[{Lighter@Red, EdgeForm@Thickness[0.01], EdgeForm@Red, Polygon[p]}] SimplePolygonQ[Polygon[p]] False


2

The original algorithm is given here. I post the slightly revised version since it perfectly fits the question. The "deintersection" algorithm Let us start from some random polygon with $n$ randomly placed vertices. Initially, it has a lot of self-intersections SeedRandom[0]; n = 10; p = RandomReal[1.0, {n, 2}]; Graphics[{Lighter@Red, EdgeForm@...


2

Use Manipulate to specify time Clear["Global`*"] $Version (* "12.3.1 for Mac OS X x86 (64-bit) (June 19, 2021)" *) Constants tmax = 2000; β1 = 10^-4; β2 = 6*^-3; p = 9/10; q = 4/5; ξ1 = 4/5; ξ2 = 9/10; ϵ = 2*^-3; p1 = 10^-2; p2 = 3*^-2; α = 10^-2; μ = 10^-2; ν = 11/20; Solution SIIJA = NDSolveValue[{ S'[t] == ν - β1*S[t]*I2[t] - ...


1

For visualization purposes only I propose a simple and robust approach using a thick boundary line: shape = CountryData["Chad", "Coordinates"]; r = 2; xmin = Min[shape[[1, ;; , 1]]] - r; xmax = Max[shape[[1, ;; , 1]]] + r; ymin = Min[shape[[1, ;; , 2]]] - r; ymax = Max[shape[[1, ;; , 2]]] + r; Graphics[{{FaceForm[Blue], EdgeForm[{...


Only top voted, non community-wiki answers of a minimum length are eligible