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: Incorrect, misleading, "Operate Directly on Graphics" example.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80933] Re: Incorrect, misleading, "Operate Directly on Graphics" example.
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 6 Sep 2007 05:17:12 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <fblji3$pji$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

and

(PolyhedronData["SnubDodecahedron"] // Normal) /.
     Polygon[x : {_, _, _}] :> {Yellow, Opacity[.3], Polygon[x]}

does not help

Regards
   Jens

Q.E.D. wrote:
> I looked at another example, "Operate Directly on Graphics".
> It's off the "New in 6" "Dynamic Graphical Input" page, the top right image,
> the small/large polyhedrons.
> URL:
> http://www.wolfram.com/products/mathematica/newin6/content/DynamicGraphicalInput/
> 
> This looks so neat, just apply a simple rule and you get this
> change...except you don't.
> 
> Here's what I tried -- input and evaluate:
> 
> PolyhedronData["SnubDodecahedron"]
> 
> Then cut and paste the graphics object and append:
> 
> /. Polygon[x : {_, _, _}] :> {Yellow, Opacity[.3], Polygon[x]}
> 
> Nothing happens, the resulting graphics object is unchanged.
> 
> So I dug around a bit and came up with a graphics object which is of the
> form (a list of polygons) expected by the rule:
> 
> Graphics3D[
>  Map[Polygon,
>   PolyhedronData["SnubDodecahedron", "VertexCoordinates"][[#]] & /@
>    PolyhedronData["SnubDodecahedron", "FaceIndices"]]]
> 
> Now cut and paste this special graphics object and again append the rule
> given by the "Operate Directly on Graphics" example:
> 
> /. Polygon[x : {_, _, _}] :> {Yellow, Opacity[.3], Polygon[x]}
> 
> And, yes it works, giving the graphics object shown as output by the
> example.
> 
> So how do you get this result just using the plain graphics object from
> PolyhedronData["SnubDodecahedron"]?
> 
> Here's what I ended up with as a rule:
> 
> /.Polygon[x_] :> {Polygon[Cases[x, Except[{_, _, _}]]],
>  {Yellow, Opacity[.3], Polygon[Cases[x, {_, _, _}]]}}
> 
> The complexity is necessary due to the way the plain graphics object is
> structured.
> It keeps an array of shared vertex coordinates and a single polygon object
> with a list of index lists into that array.
> So the rule breaks the polygon object into two parts, one without triangles
> the other with only triangles and the change applied.
> This keeps the graphics object small and allows the change to be made
> rapidly.
> 
> Q.E.D.
> 
> 
> 


  • Prev by Date: Re: How to obtain numberical value from an InverseFunction?
  • Next by Date: Re: random points!
  • Previous by thread: Incorrect, misleading, "Operate Directly on Graphics" example.
  • Next by thread: Re: Incorrect, misleading, "Operate Directly on Graphics" example.