Skip to main content
Post Undeleted by Heike, Mr.Wizard
added 3 characters in body
Source Link
Yves Klett
  • 15.7k
  • 5
  • 59
  • 134

Elaborating on Mr. Wizard´s answer, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}]; Graphics3D[ Polygon[pts, VertexColors -> Table[ConstantArray[Hue[RandomReal[]], 4], {i, n}]]] 

enter image description here

or if you are feeling particularly whimsywhimsical (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

Elaborating on Mr. Wizard´s answer, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}]; Graphics3D[ Polygon[pts, VertexColors -> Table[ConstantArray[Hue[RandomReal[]], 4], {i, n}]]] 

enter image description here

or if you are feeling particularly whimsy (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

Elaborating on Mr. Wizard´s answer, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}]; Graphics3D[ Polygon[pts, VertexColors -> Table[ConstantArray[Hue[RandomReal[]], 4], {i, n}]]] 

enter image description here

or if you are feeling particularly whimsical (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

added 115 characters in body
Source Link
Yves Klett
  • 15.7k
  • 5
  • 59
  • 134

Elaborating on Mr. Wizard´s answer, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}];   Graphics3D[ Polygon[pts, VertexColors -> Table[ConstantArray[Hue[RandomReal[]], 4], {i, n}]]] 

enter image description here

or if you are feeling particularly whimsy (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

Elaborating on Mr. Wizard´s answer, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}]; 

enter image description here

or if you are feeling particularly whimsy (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

Elaborating on Mr. Wizard´s answer, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}];   Graphics3D[ Polygon[pts, VertexColors -> Table[ConstantArray[Hue[RandomReal[]], 4], {i, n}]]] 

enter image description here

or if you are feeling particularly whimsy (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

added 15 characters in body
Source Link
Yves Klett
  • 15.7k
  • 5
  • 59
  • 134

Elaborating on thatMr. Wizard´s answer, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}]; 

enter image description here

or if you are feeling particularly whimsy (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

Elaborating on that, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}]; 

enter image description here

or if you are feeling particularly whimsy (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

Elaborating on Mr. Wizard´s answer, a quicker way to generate and render the polygons is to define your own roughshod transformation functions and use the multi-primitive syntax for Polygon together with random VertexColors. The resulting graphics is rendered way faster and is much more responsive to mouse interaction:

diamond = {{#, -#} #2, -{#, #}, {-#, #} #2, {#, #}} &; diamond3D = Polygon[{##, 0} & @@@ diamond[1, 1/2]]; n = 5000; rt[pts_, rot_, tran_] := (rot.#) + tran & /@ pts rm[axis_, \[Theta]_] := With[{ax = Normalize[axis]}, With[{x = ax[[1]], y = ax[[2]], z = ax[[3]], cos = Cos[\[Theta]], sin = Sin[\[Theta]]}, {{cos + x^2 - cos x^2, x (y - cos y) - sin z, sin y - (-1 + cos) x z}, {x (y - cos y) + sin z, cos + y^2 - cos y^2, -sin x - (-1 + cos) y z}, {-sin y - (-1 + cos) x z, sin x - (-1 + cos) y z, cos + z^2 - cos z^2}} ] ] pts = Table[ rt[diamond3D[[1]], rm[RandomReal[{0, 1}, 3], RandomReal[{0, 2 Pi}]], RandomReal[NormalDistribution[25, 6], 3] ], {n}]; 

enter image description here

or if you are feeling particularly whimsy (it is carneval time):

Graphics3D[ Polygon[pts, VertexColors -> Table[Hue[RandomReal[]], {i, n}, {t, 4}]]] 

enter image description here

added 258 characters in body
Source Link
Yves Klett
  • 15.7k
  • 5
  • 59
  • 134
Loading
Source Link
Yves Klett
  • 15.7k
  • 5
  • 59
  • 134
Loading