Re: scaling/translating Polyhedra - is this how??
- To: mathgroup at smc.vnet.net
- Subject: [mg38622] Re: scaling/translating Polyhedra - is this how??
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Wed, 1 Jan 2003 03:39:52 -0500 (EST)
- References: <aur7f0$889$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Your way certainly works (I supress the display of the outputs with final semicolons). << "Graphics`Polyhedra`" t0 = Tetrahedron[]; f0 = Function[x, 0.2*x]; t1 = Map[f0, t0, {4}]; f1 = Function[x, {x[[1]], x[[2]], x[[3]] + 0.1}]; t2 = Map[f1, t1, {3}]; Here is a shorter way using replacement e1 = t0 /. p:{__Real} :> 0.2*p + {0, 0, 0.1}; Both of the above will allows more general transformations, but for simple scaling and translation we can use the package facilities: e2 = Polyhedron[Tetrahedron, {0, 0, 0.1}, 0.2][[1]]; Check e1 === e2 === t2 True "Relishguy" <relishguy at pluggedin.org> wrote in message news:aur7f0$889$1 at smc.vnet.net... > I wanted to just display a tetrahedron scaled smaller and translated > along the z-axis like the example on p.517 of the S.Wolfram book > (V.4). After I figured out that the example used a cuboid and the > constructor for the tetrahedron would not work the same way, I devised > a way to accomplish this. However, I have seen so many exercises that > can be accomplished more easily when I gain more knowledge. > > I figured out that the tetrahedron is just a list of polygons, which > are just a list of triples. So, here goes: > > <<Graphics`Polyhedra` > t0=Tetrahedron[] > f0=Function[x,0.2*x] (* make it 20% as big *) > t1=Map[f0,t0,{4}] (* go down to level 4 *) > f1=Function[x,{x[[1]], x[[2]], x[[3]]+0.1}] (* move it up by 0.1 *) > t2=Map[f1, f2, {3}] (*this time it should work on the points *) > Show[Graphics3D[{t2}]] > > Is there some easier way to translate/scale a polyhedron (or polygon)? > > Thanks in advance. > > Regards.. > Note: Of course, I am happy that this can be accomplished at all, > using these weird "map"ings! :-)) >