MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: 3D visulaisation of 3D matrix for a 3D CA

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109471] Re: 3D visulaisation of 3D matrix for a 3D CA
  • From: "M.Roellig" <markus.roellig at googlemail.com>
  • Date: Wed, 28 Apr 2010 02:01:03 -0400 (EDT)
  • References: <hr65p7$jm7$1@smc.vnet.net>

On 27 Apr., 10:03, jongren <jongreno... at gmail.com> wrote:
> Hi,
>
> I have a 3D matrix, of the form
> {{{1, 2, 3, 4},
>   {5, 6, 7, 8},
>   {9, 10,11,12},
>   {13,14,15,16}},
>  {{17, 18, 19, 20},
>   {21, 22, 23, 24},
>   {25, 26, 27, 28},
>   {29, 30, 31, 32}}}
>
> I want to plot this matrix, where every number is a unit cube, to give a sort of 3D grid, where the number gives the colour. In reality most numbers would be 0, which would be transparent.
>
> I want to do this as I'm developing a 3D partitioned cellular automaton, and have it defined over structures of this sort, and I want to be able to visualise its development. In 2D I've used MatrixPlot and Animate to do this.
>
> One layer is 1-16, and the second is 17-32.
>
> Any help would be greatly appreciated,
>
> Thanks!

Hi,

you could try something similar to this:

Graphics3D[{Opacity[0.3],
  MapThread[{Hue[#1], Cuboid[#2]} &, {Flatten[mat/Max[mat], 2],
    Flatten[Array[2 {#1, #2, #3} &, Dimensions@mat], 2]}]}]

Cheers,

Markus


  • Prev by Date: Re: Database memory usage
  • Next by Date: Re: does not work?
  • Previous by thread: 3D visulaisation of 3D matrix for a 3D CA
  • Next by thread: Precision of calculations