3 dimensional grid

• To: mathgroup at smc.vnet.net
• Subject: [mg6851] 3 dimensional grid
• From: "Dr. Sergio Terrazas" <sterraza at campus.cdj.itesm.mx>
• Date: Thu, 24 Apr 1997 02:44:31 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hello Mathgoup:
After posting a message requesting help on creating a 3 dimensional grid
to ilustrate triple integrals, I came up with the following solution:

xmin=2;xmax=6;ymin=1;ymax=5;zmax=5;zmin=1;n=6;
dx=(xmax-xmin)/n;dy=(ymax-ymin)/n;dz=(zmax-zmin)/n;

rx=Table[z=zmin+m dz;
Table[y=ymin+l dy;
Table[Line[{{xmin,y,z},{xmax,y,z}}],{k,0,n}]
,{l,0,n}]
,{m,0,n}];
ry=Table[z=zmin+m dz;
Table[x=xmin+l dx;
Table[Line[{{x,ymin,z},{x,ymax,z}}],{k,0,n}]
,{l,0,n}]
,{m,0,n}];
rz=Table[y=ymin+m dy;
Table[x=xmin+l dx;
Table[Line[{{x,y,zmin},{x,y,zmax}}],{k,0,n}]
,{l,0,n}]
,{m,0,n}];

rx=Union[Flatten[rx]];
ry=Union[Flatten[ry]];
rz=Union[Flatten[rz]];

Show[Graphics3D[{RGBColor[1,0,0],{rx,ry,rz}}],
Boxed->False
];

I imagine it is not the most efficient and/or elegant way of doing it,
but it works. If anybody would care to indicate a more efficient way,
It will be appreciated very much.
Thanks
Saludos from Mexico,
Sergio Terrazas

```

• Prev by Date: Integrate product of Gaussian*Sin
• Next by Date: Re: Fitting Explicit Functions
• Previous by thread: Re: Integrate product of Gaussian*Sin
• Next by thread: possible bug in Cases/pattern matching??