We can using Minkowski Sum
(RegionDilation
) of any Line
's from the fixed point p
.
p = {0, 0, 0};
n = 10;
lines = Table[Line[{p, p + RandomReal[{-5, 5}, 3]}], n];
polyhedron = Fold[RegionDilation, lines];
HighlightMesh[polyhedron, {Style[1, White], Style[2, Darker@Cyan]},
ViewProjection -> "Orthographic"]
p = {0, 0};
n = 4;
lines = Table[Line[{p, p + RandomReal[{-5, 5}, 2]}], n];
poly = Fold[RegionDilation, lines];
Graphics[{FaceForm[Darker@Cyan], EdgeForm[Thick], poly, Thick,
Orange, lines /. Line -> Arrow, White, AbsolutePointSize[10],
Point[p]}]
- For 2D,we demonstrate the process of the
Region Dilation
.After that, we want to subdivide the region into some Parallelogram
s.
SeedRandom[1111];
p = {0, 0};
n = 9;
dirs = RandomPoint[Circle[{0, 0}, 1, {-(π/2), π/2}], n];
lines = Line[{p, p + #}] & /@ dirs;
polys = FoldList[RegionDilation, lines];
parts = Most@MapThread[RegionDifference, {Rest@polys, Most@polys}];
Graphics[{EdgeForm[{Thick, White}], FaceForm@RandomColor[], #} & /@
parts]
- One way to subdivede the zonogon into
Parallelogram
s.
SeedRandom[1];
p = {0, 0};
n = 11;
dirs = RandomPoint[Circle[{0, 0}, 1], n];
lines = Line[{p, p + #}] & /@ dirs;
polys = FoldList[RegionDilation, lines];
parts = Most@MapThread[RegionDifference, {Rest@polys, Most@polys}];
pts = MapThread[
Complement, {Rest[First /@ polys], Most[First /@ polys]}][[2 ;;
n - 2]];
Animate[Graphics[{MapIndexed[{ColorData[97][First@#2], #1} &, parts],
Arrowheads[.025], White,
Take[MapThread[
Arrow /@ Thread[{#1 - Threaded@#2, #1}] &, {pts,
dirs[[3 ;; n - 1]]}], i]}], {i, 1, n - 3, 1}, AnimationRate -> 1]
- By lifting the 2D data to 3D, we can found that subdivede the zonogon into
Parallelogram
s is not unique.
SeedRandom[1];
p = {0, 0};
n = 11;
dirs = RandomPoint[Circle[{0, 0}, 1], n];
pic =
Graphics3D[
Fold[RegionDilation,
Line[{{0, 0, 0}, {0, 0, 0} + #}] & /@ (PadRight[#, 3] & /@ dirs)],
ViewPoint -> Top,
ViewProjection -> "Orthographic"]; SeedRandom[];
pics =
Table[Graphics3D[
Fold[RegionDilation,
Line[{{0, 0, 0}, {0, 0, 0} + #}] & /@
MapThread[Append, {dirs, RandomReal[{0, 1}, n]}]],
ViewPoint -> Top, ViewProjection -> "Orthographic"],
4];
GraphicsRow[{pic, pics} // Flatten]
Edit
- To subdivide the 2D case to varies several
Parallelogram
s is still not so easy. Here we only provided one possible way. I think if we can find the way to change the hexagons in the figure, we will get many subdivides.
k = 7;
es = RandomReal[{0, 1}, k]*
SortBy[RandomPoint[Circle[{0, 0}, 1, {0, π}], k],
VectorAngle[{1, 0}, #] &];
level[j_] :=
MapThread[
Polygon[Join[#1, Reverse@#2]] &, {Partition[#, 2, 1] &@
FoldList[Plus, Take[es, -j]],
Partition[#, 2, 1] &@
Prepend[FoldList[Plus, Take[es, -j + 1]], {0, 0}]}];
Graphics[
Table[{FaceForm[ColorData[97][j]], EdgeForm[{White, Thick}],
level[j]}, {j, 1, k}]]
Clear[k, es, level];
k = 13;
es = AngleVector /@ Table[-(π/(2 k)) + j*π/k, {j, 1, k}];
es = CirclePoints[{1, π + π/(2 k)}, 2 k];
level[j_] :=
MapThread[
Polygon[Join[#1, Reverse@#2]] &, {Partition[#, 2, 1] &@
FoldList[Plus, Take[es, -j]],
Partition[#, 2, 1] &@
Prepend[FoldList[Plus, Take[es, -j + 1]], {0, 0}]}];
Graphics[
Table[{FaceForm[ColorData[97][j]], EdgeForm[{White, Thick}],
level[j]}, {j, 1, k}]]
- Transpose the data to get the same pattern of colors.
lear[k, es, level];
k = 13;
es = CirclePoints[{1, π + π/(2 k)}, 2 k];
level[j_] :=
MapThread[
Polygon[Join[#1, Reverse@#2]] &, {Partition[#, 2, 1] &@
FoldList[Plus, Take[es, -j]],
Partition[#, 2, 1] &@
Prepend[FoldList[Plus, Take[es, -j + 1]], {0, 0}]}];
polys = Flatten[Table[level[j], {j, 1, k}], {{2}, {1}}];
Graphics[
Table[{FaceForm[ColorData[97][i]], EdgeForm[{Thick, White}],
polys[[i]]}, {i, 1, k - 1}]]
a mathematical conjecture
It seems that every "StarShaped"
can be extend to a unique "Convex"
by extend Parallelogram
.(the code need to be improved)
And every "StarShaped"
which construct by Parallelogram
s can be extend to a unique "Zonogon"
.