Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: is the visibility of a Polygon[] exposed?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83709] Re: is the visibility of a Polygon[] exposed?
  • From: m.r at inbox.ru
  • Date: Wed, 28 Nov 2007 05:48:50 -0500 (EST)
  • References: <figuou$foo$1@smc.vnet.net>

On Nov 27, 5:24 am, congruentialumina... at yahoo.com wrote:
> Hello Mathematica UG:
>
> Is it possible for my code to tell if a Polygon (in my graphics
> object) is visible?
>
> I assume that this is based upon (or is affected by) the ViewPoint->
> setting.
>
> Further, I assume that the kernel is deriving this somewhere to do
> rendering. Do I have any access to this?
>
> If I evaluate:
>
> q = PolyhedronData["SnubCube"]
>
> I can see the component Polygon[] and GraphicsComplex[] objects that
> make up the Graphics3D[]. I want to make a code decision based on
> whether a face is showing.
>
> TIA.
>
> Regards..Roger W.

This doesn't look perfect because it draws every edge twice, but it
gives a general idea:

DynamicModule[{gr, p, cent},
 {p, cent} = {Max@ #, Mean@ #}&@
   N@ PolyhedronData["SnubCube", "VertexCoordinates"];
 p *= 2 {1.3, -2.4, 2.};
 gr = PolyhedronData["SnubCube", "Faces"] // N // Normal;
 gr = gr /. Polygon[L_?MatrixQ, ___] :>
    {Dynamic@ If[Det@
       {L[[2]] - L[[1]], L[[3]] - L[[1]], p - cent - L[[1]]} >= 0,
      Thick, Dashed],
     Line@ Append[L, L[[1]]]};
 Graphics3D[gr, Boxed -> False,
  ViewCenter -> Dynamic[Automatic, None],
  ViewVector -> Dynamic@ {p, cent}]
]

Maxim Rytin
m.r at inbox.ru


  • Prev by Date: Re: Mathematica 6.0 Desperation
  • Next by Date: Re: Mathematica 6.0 Desperation
  • Previous by thread: Re: is the visibility of a Polygon[] exposed?
  • Next by thread: Re: is the visibility of a Polygon[] exposed?