Group Abstract Group Abstract

Message Boards Message Boards

[GIF] Gerontocracy (circular slices of a triangle)

6 Replies

enter image description here -- you have earned Featured Contributor Badge enter image description here Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

POSTED BY: EDITORIAL BOARD
Posted 11 years ago

Indeed a beautiful GIF! Inspired by some of Vitaly's ideas, I came up with the following. I used Overlay and created a mask by means of a triangular AlphaChannel "hole" in the image. Hope this helps you to further improve this:

Manipulate[
 Module[{mask, cols},
  cols = RGBColor /@ {"#118DF0", "#ECECDA", "#FF304F", "#0E2F56"};
  mask = Image[
    Graphics[SSSTriangle[1, 1, 1], 
     PlotRange -> {{-.1, 1.1}, {-0.2, 1}}]];
  Overlay[{
    Graphics[{Thickness[.02], CapForm["Round"], 
      Table[{cols[[i]], 
        Circle[SSSTriangle[1, 1, 1][[-1, i]], 
         r, {2 \[Pi] /3 (i - 1), \[Pi] (2 i - 1)/3}]}, {r, s, 1.02, 
        1/n}, {i, 3}]}],
    SetAlphaChannel[Image[Graphics[{}, Background -> cols[[-1]]]], 
     mask]}]],
 {s, 0., 1/n}, {{n, 25}, None}]

enter image description here

POSTED BY: Erik Mahieu

This is beautiful, @Clayton Shonkwiler, thank you for sharing! In Graphics3D we have ClipPlanes to cut away portions of a 3D scene from the resulting view. You are right, in 2D (and 3D) we have RegionFunction but then you need to use Plot / Plot3D etc. - plotting functions. On the other hand I think Show and Overlay can combine objects with transparency holes. So you can create a template in a Plot-ing function (via RegionFunction), leading design in Graphics, and then block parts of the design with the template using Show or Overlay. Not sure how practical this is, just dwelling on ideas. Perhaps this might be of use too:

Filling a polygon with a pattern of insets

POSTED BY: Vitaliy Kaurov

I've already advocated a few times for a ClippingMask function, like illustrator/gimp/photoshop has. I think Mathematica really should have it. It probably already has such construct anyhow for the plotting functions.

ClippingMask[object,mask] which shows parts of object (or objects) that are covered by mask. Where mask can be a polygon, region, bspline, rectangle, disk, ellipse, .......

POSTED BY: Sander Huisman
Posted 11 years ago

By lack of better, I am using the following combination of Overlay and SetAplhaChannel to mask images with square or round masks (illustrated with a Manipulate):

Manipulate[Module[{im, sz, mask},
  im = ImageResize[ExampleData[{"TestImage", "Lena"}], 350];
  sz = ImageMeasurements[im, "Dimensions"];
  mask = ImageResize[
    ColorNegate@
     Blur[Image[Graphics[RegularPolygon[pos, r, n], PlotRange -> 1]], 
      blur], Most@sz];
  Overlay[{Switch[bg, "black", mask, "white", Nothing], 
    SetAlphaChannel[im, mask]}]],
 Grid[{
   {Control[{{r, .95, "size"}, .5, 1.25, ImageSize -> Small}], 
    Control[{{blur, 0}, 0, 50, ImageSize -> Small}]},
   {Control[{{n, 4, "shape"}, {3 -> "triangle", 4 -> "square", 
       36 -> "round"}}],
    Control[{{pos, {0, 0}, "position"}, {-.5, -.5}, {.5, .5}, 
      Slider2D, ImageSize -> 70}]},
   {Control[{{bg, "black", "color"}, {"black", "white"}}], 
    SpanFromAbove}}, Alignment -> {Left}, ItemSize -> 22]]

here are some results: enter image description here

POSTED BY: Erik Mahieu
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard