Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

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:
>


  • Prev by Date: Re: Help with formatting output
  • Next by Date: Re: ParametricPlot3D between two curves
  • Previous by thread: Re: Problems updating Graphics3D Polygons
  • Next by thread: Re: Re: Problems updating Graphics3D Polygons