Re: Problems updating Graphics3D Polygons

*To*: mathgroup at smc.vnet.net*Subject*: [mg77643] Re: [mg77570] Problems updating Graphics3D Polygons*From*: DrMajorBob <drmajorbob at bigfoot.com>*Date*: Thu, 14 Jun 2007 05:28:56 -0400 (EDT)*References*: <30397362.1181736708391.JavaMail.root@m35>*Reply-to*: drmajorbob at bigfoot.com

"In[473]:ExpandZ[g_,ratio_]: g/.Polygon[pts_]:>Polygon[{#[[1]],#[[2]],#[[3]]*ratio}& /@pts];" There are a couple of "=" signs missing; not sure what you're seeing at your machine. This works at mine: Clear[expandZ] expandZ[g_, ratio_] := g /. Polygon[pts_] :> Polygon[{#[[1]], #[[2]], #[[3]]*ratio} & /@ pts]; But I prefer Clear[expandZ] expandZ[g_, ratio_] := g /. Polygon[pts_] :> Polygon[pts.{{1, 0, 0}, {0, 1, 0}, {0, 0, ratio}}]; Bobby On Wed, 13 Jun 2007 06:28:25 -0500, chuck009 <dmilioto at comcast.com> wrote: > Hello guys. Can you help me write a function which takes a Graphics3D > object and multiplies the z-coordinate of each point of all the polygons > by a ratio. This is what I have so far but it's not working: > > In[473]:ExpandZ[g_,ratio_]: > g/.Polygon[pts_]:>Polygon[{#[[1]],#[[2]],#[[3]]*ratio}& /@pts]; > > When I test it with this simple Graphics3D object: > > gobject=Graphics3D[{Polygon[{{0.,0.5,1.28},{0.,0.,1.},{0.5,0.,1.28},{0.5, > 0.5,1.64}}],Polygon[{{ > 0.5,0.5,1.64},{0.5,0.,1.28},{1.,0.,2.71},{1.,0.5,3.49}}]}]; > > It doesn't do anything: > > g2=Expand[gobject,2] > InputForm[g2] > > Out[475]Ã¢ï¿½Æ?Graphics3DÃ¢ï¿½Æ? > > Out[476]//InputFormGraphics3D[{Polygon[{{0., 0.5, 1.28}, {0., 0., 1.}, > {0.5, 0., 1.28}, {0.5, 0.5, 1.64}}], > Polygon[{{0.5, 0.5, 1.64}, {0.5, 0., 1.28}, > {1., 0., 2.71}, {1., 0.5, 3.49}}]}] > > I'll keep working on it. Thanks! > > -- DrMajorBob at bigfoot.com