Skip to content

Instantly share code, notes, and snippets.

@Orbifold
Created October 2, 2014 06:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Orbifold/a418ea354e01f76a6018 to your computer and use it in GitHub Desktop.
Save Orbifold/a418ea354e01f76a6018 to your computer and use it in GitHub Desktop.
Penrose drawing style
g3 = Graphics3D[{Gray, KnotData[{6, 2}, "ImageData"]},
Lighting -> "Neutral", Boxed -> False];
img = ColorConvert[Rasterize[g3, "Image", ImageResolution -> 72],
"GrayLevel"];
edge = ColorNegate@EdgeDetect[img];
Manipulate[
dots = Image@
Map[RandomChoice[{#, 1 - #} -> {1, 0}] &,
ImageData@ImageAdjust[img, {0, c, g}], {2}];
ImageMultiply[dots, edge], {c, 0, 2}, {g, 1, 3}]
ImageMultiply[
ColorNegate@
Dilation[Thinning@
EdgeDetect@
ColorConvert[Rasterize[g3, "Image", ImageResolution -> 3.3 72],
"GrayLevel"], 1],
Binarize@ImageResize[
Image@Map[RandomChoice[{#, 1 - #} -> {1, 0}] &,
ImageData@ImageAdjust[img, {0, 1.1, 1.65}], {2}], Scaled[3.3]]]
@Orbifold
Copy link
Author

Orbifold commented Oct 2, 2014

For more info see Numerics.io or Orbifold's site

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment