MathGroup Archive 2002

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

Search the Archive

RE: Problem with 3D Polygon

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33424] RE: [mg33402] Problem with 3D Polygon
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Thu, 21 Mar 2002 09:27:02 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

> -----Original Message-----
> From: Kevin J. McCann [mailto:kmccann at umbc.edu]
To: mathgroup at smc.vnet.net
> Sent: Wednesday, March 20, 2002 7:53 AM
> To: mathgroup at smc.vnet.net
> Subject: [mg33424] [mg33402] Problem with 3D Polygon
> 
> 
> When I plot the following
> 
> Graphics3D[{LightBlue,
>         Polygon[{{1,0,0},{1,0,1},{-1,0,1},{-1,0,0},{-1/2,0,0},{-1/2,0,
>               1/2},{1/2,0,1/2},{1/2,0,0},{1,0,0}}]}],Lighting->False,
>     Boxed->False];
> 
> I get just a blue rectangle with some of the boundary drawn, 
> not an inverted
> "U" shape. Can someone explain this please.
> 
> Kevin
> 
> 
> 
Kevin,

this is a problem frequently occurring, and you'll certainly find much on
this in the archive. For reasons of algorithmic efficiency, Mathematica can
correctly draw only those (flat) Polygons in 3D, which are star-shaped with
respect to its first point (e.g. all convex polygons do have this property).
So the simplest way to get your display right is to break your polygon into
convex ones.

Calling your polygon above p0, then with

p0seg = Polygon[p0[[1, #]]] & 
             /@ {{7, 8, 1, 2}, {2, 3, 6, 7}, {3, 4, 5, 6}}
 
Show[Graphics3D[{{Hue[.45, .2, 1], EdgeForm[], p0seg}, Line @@ p0}], 
    Lighting -> False, Boxed -> False]

gives a "correct" display.


To break up the polygons by program is a nice exercise, not trivial though.
I recently made a quick hack, which works fine, but is not for publication
(it's O[n^2], I think there are O[n log n] algorithms). You certainly will
find something in the MathGroup archive (by Martin Kraus, if I remember
right). Otherwise consult a text on algorithmic geometry.

BTW a Delaunay triangulation will not do it (but you may fix it up).

--
Hartmut Wolf


P.S. yes, look for Martin Kraus' contribution at
http://library.wolfram.com/mathgroup/archive/2000/Feb/msg00388.html



  • Prev by Date: ListPlot with multiple (related) series.
  • Next by Date: Re: RE: Re: newbie question - printing Pi
  • Previous by thread: Re: Problem with 3D Polygon
  • Next by thread: Re: Problem with 3D Polygon