Re: Mathematica bug in Graphics3D ??

• To: mathgroup at smc.vnet.net
• Subject: [mg22249] Re: Mathematica bug in Graphics3D ??
• From: Martin Kraus <Martin.Kraus at informatik.uni-stuttgart.de>
• Date: Sat, 19 Feb 2000 01:33:51 -0500 (EST)
• Organization: Institut fuer Informatik, Universitaet Stuttgart
• References: <88juec\$9o3@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Axel Kowald wrote:
>
> Hello,
>
> I'm using Mathematica 4.0.1.0 under NT4 and when I try:
>
> Show[Graphics3D[Polygon[{{2.5, Sqrt[3]/2, 0}, {3.5, Sqrt[3]/2, 0},
> {4, Sqrt[3], 0}, {3, 2*Sqrt[3], 0}, {2, 2*Sqrt[3], 0},
> {3, Sqrt[3], 0}} ]], Axes -> True]
>
> Mathematica draws a polygon with only 5 corners where the last point
> {3,Sqrt[3],0} is missing. Am I doing something wrong here or what is
> going on ?
>
> Many thanks
>
>                 Axel
>

Hi Axel,

your polygon is non-convex (check it by replacing Polygon by Line)
which is a problem for three-dimensional graphics in Mathematica.
As explained in the book "Mathematica Graphics -
Techniques & Applications" by Tom Wickham-Jones in section 9.3
(Polygon Triangulation) on page 155:

"Since there are several methods [to triangulate polygons],
Mathematica chooses one that is simple and easy to understand. It joins
the first vertex to successive pairs of vertices around the edge."

I do not want to discuss this decision. However, it should be noted
that this method works consistently for non-flat polygons.

Unfortunately, this method does not produce the result you
expected for your polygon. In order to get the expected result you
should project the polygon into 2d, compute a standard triangulation
of the projected polygon and use this triangulation for the 3d points.
Tom Wickham-Jones presents some code to do this in his book (included
in the ExtendGraphics package in MathSource).

Another source of code to do this is my PolygonTriangulation
package:

http://library.wolfram.com/packages/polygontriangulation/

After installing the package it works like this:

<< PolygonTriangulation`SimplePolygonTriangulation`

Show[TriangulateSimplePolygons3D[
Graphics3D[
Polygon[{{2.5, Sqrt[3]/2, 0}, {3.5, Sqrt[3]/2, 0}, {4, Sqrt[3],
0}, {3,
2*Sqrt[3], 0}, {2, 2*Sqrt[3], 0}, {3, Sqrt[3], 0}}]]],
Axes -> True]

This will show what you are probably expecting.

Greetings

Martin Kraus

```

• Prev by Date: Re: pure functions (or not?)
• Next by Date: Re: export graphics
• Previous by thread: Re: Mathematica bug in Graphics3D ??
• Next by thread: Re: Mathematica bug in Graphics3D ??