Re: Re: Problems updating Graphics3D Polygons
- To: mathgroup at smc.vnet.net
- Subject: [mg77763] Re: Re: Problems updating Graphics3D Polygons
- From: chuck009 <dmilioto at comcast.com>
- Date: Sat, 16 Jun 2007 03:28:58 -0400 (EDT)
That's tough for me to follow. Looks like polymorphism. Was not aware I could do that in Mathematica. Nice to read and study other peoples code here. That helps me get better. The Mathematica syntax is the tough part for me but I'm getting better by hanging out here :) > A solution doesn't HAVE to be this flexible, but... > why the heck not? > > Clear[scaleZ, array, threeD] > array[dims_List] = ArrayQ[#] && Dimensions[#] == dims > &; > threeD[m_?(array[{3, 3}])] := m > threeD[m_?(array[{3}])] := DiagonalMatrix@m > threeD[f_?NumericQ] := DiagonalMatrix@{1, 1, f} > scaleZ[graphics_, m_] := > graphics /. Polygon[pts_] :> Polygon[pts.threeD[m]] > > Try it out: >