chaos2D[m_: 0, k_, s_: {0, 0}, n_: 0, d_: 0, ps_: Medium] := Module[{poly, q}, poly = Table[RotationMatrix[i 360/m].{0, 1}, {i, m}] // N; q = k s + (1 - k) RandomChoice[poly]; data = NestList[(k # + (1 - k) RandomChoice[poly]) &, q, n]; Graphics[{{White, Polygon[poly]}, {AbsolutePointSize[ps], Point[Drop[data, d]]}, {Blue, PointSize[.035], Point[s]}}, ImageSize -> {500, 500}]] Manipulate[k := 0.5; If[n < d, n = d]; chaos2D[m, k, s, n, d, ps], Style["parameters", Bold], {{ps, Medium, "pointsize"}, {Tiny -> "tiny", Small -> "small", Medium -> "medium"}}, {{d, 0, "droppedpoints"}, 0, 20, 1, Appearance -> "Labeled", ImageSize -> Tiny}, {{n, 50, "numberofpoints"}, 0, 500, 10, Appearance -> "Labeled", ImageSize -> Tiny}, Delimiter, Delimiter, PaneSelector[{2 -> Column[{Style["polygons", Bold], Control[{{m, 3, "numberofedges"}, Range[3, 10]}], Control[{{s, {0.5, .5}, "startpoint"}, {-1, -1}, {1, 1}, ImageSize -> {{200, 200}, {200, 200}}}]}], 3 -> Column[{Style["polyhedra", Bold], Control[{{f, 4, "numberoffaces"}, {4, 6, 8, 12, 20}}], Control[{{ss, {1, 1, 1}, "startpoint3D"}, {-1, -1, -1}, {1, 1, 1}}]}]}, Dynamic[dimension]], ControlPlacement -> Left, TrackedSymbols :> {dimension, ps, s, m, ss, k, n, f, d}, SaveDefinitions -> True, AutorunSequencing -> {2, 3, 5, 7}]