MathGroup Archive 2007

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

Search the Archive

Re: Problems updating Graphics3D Polygons

  • To: mathgroup at smc.vnet.net
  • Subject: [mg77620] Re: Problems updating Graphics3D Polygons
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 14 Jun 2007 05:17:09 -0400 (EDT)
  • References: <f4ol3r$6uj$1@smc.vnet.net>

Hi,

this will prbably fail with Mathematica 6
  but

ExpandZ[g_, ratio_] :=
   g /. Polygon[pts_] :> Polygon[#*{1, 1, ratio} & /@ pts];

should do it in version 5.x

Regards
   Jens


chuck009 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]//InputForm=
> 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}}]}]
> 
> I'll keep working on it.  Thanks!
> 


  • Prev by Date: Re: Simplify 0/0 to 1?
  • Next by Date: Re: 6.0 Get Graphics Coordinates...
  • Previous by thread: Re: Problems updating Graphics3D Polygons
  • Next by thread: Re: Problems updating Graphics3D Polygons