1
|
11034 Views
|
7 Replies
|
7 Total Likes
View groups...
Share
GROUPS:

# Partition images into hexagons ?

Posted 9 years ago
 I am trying to partition images into hexagons. Is that possible in Mathematica?
7 Replies
Sort By:
Posted 9 years ago
Posted 9 years ago
 This model is the theory of Christaller or Lösch to explain hierarchy of cities An image illustrating these theories: Posted 9 years ago
 If one can build such a figure from polygons in Mathematica, then it is easy to use the same procedure - just this simple line will make texture mapping (partitioning): Cases[ ..... , Polygon[p_, ___] :> Polygon[p, VertexTextureCoordinates -> p], Infinity] no matter what complex arrangement of polygons we deal with.
Posted 9 years ago
 The solutions proposed by Vitally are very interesting A question : We have only two level of hexagones. Do you have a simple solution for 3, 4 or 5 levels?
Posted 9 years ago
 I am not sure what "3, 4 or 5 levels" would look like - is there a link to a picture somewhere?
Posted 9 years ago
 It is a bit not clear what you mean. Say you mean a simple overlap... h[x_, y_] := Polygon[Table[.1 {Cos[2 Pi k/6] + x, Sin[2 Pi k/6] + y}, {k, 6}]] hex = Graphics[{EdgeForm[Directive[Black, Thick]], FaceForm[], LightBlue, Table[h[3 i + 3 ((-1)^j + 1)/4, Sqrt/2 j], {i, 3}, {j, 10}]}, ImageSize -> 512] ImageMultiply[{ExampleData[{"TestImage", "Lena"}], Rasterize@hex}] Or maybe you'd like something (adopted from here ) fancier... Manipulate[SeedRandom; Graphics[{EdgeForm[Black], Texture[ExampleData[{"TestImage", "Lena"}]], GeometricTransformation[#, Composition[TranslationTransform@RandomReal[.1 s {-1, 1}, 2], RotationTransform[s RandomReal[{-Pi, Pi}], Mean@First[#]]]] & /@ Cases[Normal@hex, Polygon[p_, ___] :> Polygon[p, VertexTextureCoordinates -> p], Infinity]}], {s, 0, 1}] Posted 9 years ago
 The basic Image format is rectangular. ImagePartition only partitions Images into rectangular portions. You could however presumably make use of ImagePartition with various sizes and offsets to create a set of square crops at hexagonal grid points. Then these could be masked to remove the areas outside of the hexagonal region in each--leaving those areas transparent. This then could be used as an in-effect hexagonal partition. Of course the devil is in the details...