POV-Ray : Newsgroups : povray.advanced-users : Polygon planarity Server Time
26 Nov 2024 01:48:43 EST (-0500)
  Polygon planarity (Message 1 to 7 of 7)  
From: Eric Dowty
Subject: Polygon planarity
Date: 30 Mar 2001 13:56:25
Message: <3AC4D788.930EAA99@shapesoftware.com>
I am adding POV-Ray file support to my commercial programs for drawing
atomic structure and external shapes of crystals
(www.shapesoftware.com).  This is just about complete and the results
are very good except for one problem.

I use polygons of various sizes for crystal faces, faces of atomic
coordination polyhedra, etc., which are all defined by corners.  POV-Ray
seems to want polygons to be planar to about the tenth decimal, whereas
at the moment I am using 4-byte FP variables which are only good to
about the fifth decimal.  Thus POV-Ray often rejects these polygons.
Even if I convert to 8-byte variables, I doubt if general precision
could be maintained to the tenth decimal point, as the user has the
option of rotating the 3D objects before writing the POV-Ray file, and
there are certain other approximations which are used in some cases.

For my purposes the best solution to this problem would be to have an
adjustable precision for the polygon planarity test, e.g.

precision = 0.0001

Maybe there is something like this already, but I could not find it in
the Help file.

I might mention that my programs use other 3D packages, including OpenGL
on Windows and Macintosh, QuickDraw 3D on Mac, and VRML files, and this
problem has never arisen with them, so it would seem that a super-high
degree of precision is not necessary.

Eric Dowty
dow### [at] shapesoftwarecom


Post a reply to this message

From: Ron Parker
Subject: Re: Polygon planarity
Date: 30 Mar 2001 14:09:01
Message: <slrn9c9mef.u0.ron.parker@fwi.com>
On Fri, 30 Mar 2001 13:59:20 -0500, Eric Dowty wrote:
>For my purposes the best solution to this problem would be to have an
>adjustable precision for the polygon planarity test, e.g.
>
>precision = 0.0001
>
>Maybe there is something like this already, but I could not find it in
>the Help file.
>
>I might mention that my programs use other 3D packages, including OpenGL
>on Windows and Macintosh, QuickDraw 3D on Mac, and VRML files, and this
>problem has never arisen with them, so it would seem that a super-high
>degree of precision is not necessary.

I think you'll find that those other programs turn your polygons into 
triangles internally.  POV-Ray does not.

A solution that will work for you today would be to transform your polygons
so they lie in a plane that's parallel to two of the three axes, then add
code to the POV file to transform each one back to where you want it.  If
you make your polygon lie in the X-Y plane, for example, you could force
the Z coordinates to a constant value, which would pass any precision test
with flying colors.  This shouldn't involve more than one rotation for you
and the opposite rotation for POV.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Rune
Subject: Re: Polygon planarity
Date: 30 Mar 2001 16:35:05
Message: <3ac4fc09$1@news.povray.org>
How about using several triangles instead of one polygon?

Rune
--
\ Include files, tutorials, 3D images, raytracing jokes,
/ The POV Desktop Theme, and The POV-Ray Logo Contest can
\ all be found at http://rsj.mobilixnet.dk (updated March 29)
/ Also visit http://www.povrayusers.org


Post a reply to this message

From: Eric Dowty
Subject: Re: Polygon planarity
Date: 31 Mar 2001 11:02:36
Message: <3AC6004A.567C546A@shapesoftware.com>
Rune wrote:

> How about using several triangles instead of one polygon?
>
> Rune
> --

There are several possible immediate solutions - I am thinking at the
moment that I will convert the polygons to planes and use "intersection"
to make polyhedra.  I use this already for drawing crystals, where the
face equations (not corners) are the primary data.

It would seem that the polygon option in POV-Ray does not really work
unless the corners are set up in two dimensions - it is unrealistic in
general to expect the user to supply 3-D coordinates to the tenth
decimal (if in fact this would work anyway for general 3D points).   Is
the planarity test really necessary?  Even if it is, would it not be
possible to fudge the corners (within limits) to enforce planarity?

Eric


Post a reply to this message

From: Christoph Hormann
Subject: Re: Polygon planarity
Date: 31 Mar 2001 11:34:54
Message: <3AC6072F.6DE3DB95@gmx.de>
Eric Dowty wrote:
> 
> There are several possible immediate solutions - I am thinking at the
> moment that I will convert the polygons to planes and use "intersection"
> to make polyhedra.  I use this already for drawing crystals, where the
> face equations (not corners) are the primary data.

You should know that this is a very slow solution in contrast to a
triangle mesh.  An intersection of many planes is one of the lowest things
you can have in povray if you don't use manual bounding.

> 
> It would seem that the polygon option in POV-Ray does not really work
> unless the corners are set up in two dimensions - it is unrealistic in
> general to expect the user to supply 3-D coordinates to the tenth
> decimal (if in fact this would work anyway for general 3D points).   Is
> the planarity test really necessary?  Even if it is, would it not be
> possible to fudge the corners (within limits) to enforce planarity?
> 

If you really want to use a polygon object, why don't you set it up in 2d
and transform it like Ron suggested.  The 'fudging' you suggested would
work exactly the same way.  

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Eric Dowty
Subject: Re: Polygon planarity
Date: 31 Mar 2001 11:55:03
Message: <3AC60C96.6E392299@shapesoftware.com>
To answer my own question, the extreme tolerance in the planarity test for
polygons does not seem to be necessary.  I recompiled POV-Ray, changing the
line

    if (fabs(d) > ZERO_TOLERANCE)

in Compute_Polygon (Polygon.c)

to

    if (fabs(d) > 0.0002)

This is the tolerance value I used to set up the polygons in the first
place.  Now POV-Ray will do my files with no problems - I attach a sample.

Assuming that this causes no other problems, this would obviously be a
useful change in POV-Ray.  To have to convert a set of corners to triangles
or rotate back and forth seems to be unecessary extra work.  Again the
tolerance value could be an option, if there is any reason for having a
tolerance of 0.0000000001 at all.

Eric


Post a reply to this message


Attachments:
Download 'forsterite.pov.txt' (24 KB)

From: Warp
Subject: Re: Polygon planarity
Date: 2 Apr 2001 07:29:29
Message: <3ac86299@news.povray.org>
Eric Dowty <dow### [at] shapesoftwarecom> wrote:
: There are several possible immediate solutions - I am thinking at the
: moment that I will convert the polygons to planes and use "intersection"
: to make polyhedra.

  Don't expect mind-blowing fast renders if you do this.

  Just convert your polygons to triangles and put them in a mesh.
The rendering times will be worth the work.

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.