Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Graphics3D and polygons

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15816] Re: Graphics3D and polygons
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Fri, 12 Feb 1999 18:39:38 -0500 (EST)
  • References: <79jggg$sas@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Dr. Christopher J. Purcell wrote in message <79jggg$sas at smc.vnet.net>...
>This may just be finger trouble but I can't get nonconvex polygons to
>plot correctly under Graphics3D with either V2.2 or V3.0. The only
>reference I can find is
>http://www.mathsource.com/Content/Applications/Graphics/2D/0209-854 but
>it causes an unacceptable performance hit. Any faster fixes known? Here
>is an example of the problem...
>
>(2D polygon works fine - gives a red bow tie *)
>
>Show[Graphics[{RGBColor[1, 0, 0],
>Polygon[{{0,0},{50,25},{100,0},
>{100, 100},{50,80},{0, 100},{0, 0}
>}]}],AspectRatio->Automatic];
>
>(* same polygon as above in 3D is drawn wrong *)
>
>Show[Graphics3D[{RGBColor[1, 0, 0],
>Polygon[{{0,0},{50,25},{100,0},
>{100, 100},{50,80},{0, 100},{0, 0}
>}/.{a_,b_}->{a,b,0}]},
>ViewPoint->{0,0,10},Boxed->False,
>RenderAll->True,
>AspectRatio->Automatic]];
>
>

Christopher:

In 2D the interior (colored part) of a polygon is taken to be the set of
points around which the winding number of  the perimeter path  is
non-zero.

In3D the polygon is split into triangles by joining the first point to
successive pairs of points {{p1,p2,p3},{p1,p3,p4}, ...} For the purpose
of coloring by simulated lighting, all of  these triangles are colored
with the color calculated for the first triangle (from its normal and
the light sources).

The only fix seems to  be to reorder the points or even triangulate
yourself - and that could alter the simulated coloring - but  you would
be OK with explict coloring by Hue etc.

In this case, rotating the points to the left gives a bow tie

Show[Graphics3D[{RGBColor[1, 0, 0],
Polygon[
    RotateLeft[{
     {0,0},{50,25},{100,0},
            {100, 100},{50,80},{0, 100},{0, 0}

    }]/.{a_,b_}->{a,b,0}]},
ViewPoint->{0,0,10},Boxed->False,
RenderAll->True,
AspectRatio->Automatic
]]


Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565




  • Prev by Date: Text in Metafiles ...
  • Next by Date: Position Available
  • Previous by thread: Re: Graphics3D and polygons
  • Next by thread: Using Mathem.. to learn calculus? or Statistics?