Re: Plotting polyhedra
- To: mathgroup at smc.vnet.net
- Subject: [mg62223] Re: [mg62207] Plotting polyhedra
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 16 Nov 2005 02:28:26 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Peter,
How about this?
v1 = {0, 0, 0};
v2 = {1, 0, 0};
v3 = {0, 1, 0};
v4 = {0, 0, 1};
Show[Graphics3D[{Polygon[{v1, v2, v3}], Polygon[{v1, v2, v4}],
Polygon[{v1, v4, v3}], Polygon[{v4, v2, v3}]}]];
But if you are going to plot many tetrahedrons...
tetrahedron[{v1_, v2_, v3_, v4_}] := {Polygon[{v1, v2, v3}],
Polygon[{v1, v2, v4}], Polygon[{v1, v4, v3}], Polygon[{v4, v2, v3}]};
Show[Graphics3D[
{tetrahedron[{v1, v2, v3, v4}],
tetrahedron[{{1, 1, 1}, {1, 2, 3}, {2, 4, 1}, {3, 2, 1}}]}]
];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: King, Peter R [mailto:peter.king at imperial.ac.uk]
To: mathgroup at smc.vnet.net
I wish to be able to plot polyhedra given a table of (xyz) coordinates
for vertices. I'd be happy if I was restricted to tetrahedra, but would
prefer to be able to deal with general polyhedra. I can always plot the
polygons that make up the faces of the polyhedron but this seems a bit
tedious, is there a more efficient way than (for example)
Show[Graphics3D[{Polygon[{{0,0,0},{1,0,0},{0,1,0}}],Polygon[{{0,0,0},{1,
0,0},{0,0,1}}],Polygon[{{0,0,0},{0,0,1},{0,1,0}}],Polygon[{{0,0,1},{1,0,
0},{0,1,0}}]}]]
Which involves putting in the coordinates of each vertex 3 times.
Thanks.