POV-Ray : Newsgroups : povray.general : Bug report: shapes2.inc icosahedron numerical inaccuracy Server Time
24 Nov 2024 08:50:32 EST (-0500)
  Bug report: shapes2.inc icosahedron numerical inaccuracy (Message 1 to 4 of 4)  
From: Robert Munyer
Subject: Bug report: shapes2.inc icosahedron numerical inaccuracy
Date: 21 Jul 2019 16:53:10
Message: <87imrvxg7g.fsf@munyer.com>
I wanted an icosahedron module for OpenSCAD, and didn't find anything
on-line that I liked, so I wrote this:

  intersection_for
      (a_z = [-180 : 72 : 179],
       a_y = [atan2 (4, 3 + sqrt (5)),
              atan2 (sqrt (10 + sqrt (20)), sqrt (5 - sqrt (20)))])
    rotate ([0, a_y, a_z])
      cube ([2, 2, sqrt (3/4) + sqrt (5/12)], true);

I thought that I could double-check my math by verifying that my
angles matched POV-Ray's angles.  They didn't quite match.  A close
view of a POV-Ray icosahedron vertex reveals that it is malformed
(see PNG in message with same subject, in povray.binaries.images).

calculated: 52.6226318593503043571428615050624824299049526181
pov-ray:    52.6625

calculated: 10.8123169635717062912849447744842228988908330822
pov-ray:    10.8125

One of POV-Ray's angles is wrong only in the last digit, but the
other angle has _three_ wrong digits.


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

From: Le Forgeron
Subject: Re: Bug report: shapes2.inc icosahedron numerical inaccuracy
Date: 22 Jul 2019 04:25:54
Message: <5d357312$1@news.povray.org>
Le 21/07/2019 à 22:53, Robert Munyer a écrit :
> I wanted an icosahedron module for OpenSCAD, and didn't find anything
> on-line that I liked, so I wrote this:
> 
>   intersection_for
>       (a_z = [-180 : 72 : 179],
>        a_y = [atan2 (4, 3 + sqrt (5)),
>               atan2 (sqrt (10 + sqrt (20)), sqrt (5 - sqrt (20)))])
>     rotate ([0, a_y, a_z])
>       cube ([2, 2, sqrt (3/4) + sqrt (5/12)], true);
> 
> I thought that I could double-check my math by verifying that my
> angles matched POV-Ray's angles.  They didn't quite match.  A close
> view of a POV-Ray icosahedron vertex reveals that it is malformed
> (see PNG in message with same subject, in povray.binaries.images).
> 
> calculated: 52.6226318593503043571428615050624824299049526181
> pov-ray:    52.6625
> 
> calculated: 10.8123169635717062912849447744842228988908330822
> pov-ray:    10.8125
> 
> One of POV-Ray's angles is wrong only in the last digit, but the
> other angle has _three_ wrong digits.
> 

You are correct.
From wikipedia, the dihedral angle in icosahedron should be
pi-acos(sqrt(5)/3), which is 138,189685104221 degrees, it's complement
is 41,8103148957786 degrees.

The difference between pov-ray planes is 41.85 degrees, a bit too much.

The precision should probably be limited to 11 digits after the decimal
dot, similar to the dodecahedron.

But actually, just fixing the 52.6625 with 52.6225 is already enough to
solve the intersection of the 5 planes of your scene.

On the same line of precision, the tetrahedron should use something
along 19.47122063449 instead of 19.47


Post a reply to this message

From: Le Forgeron
Subject: Re: Bug report: shapes2.inc icosahedron numerical inaccuracy
Date: 22 Jul 2019 05:01:18
Message: <5d357b5e$1@news.povray.org>
Le 21/07/2019 à 22:53, Robert Munyer a écrit :
> I wanted an icosahedron module for OpenSCAD, and didn't find anything
> on-line that I liked, so I wrote this:
> 
>   intersection_for
>       (a_z = [-180 : 72 : 179],
>        a_y = [atan2 (4, 3 + sqrt (5)),
>               atan2 (sqrt (10 + sqrt (20)), sqrt (5 - sqrt (20)))])
>     rotate ([0, a_y, a_z])
>       cube ([2, 2, sqrt (3/4) + sqrt (5/12)], true);
> 
> I thought that I could double-check my math by verifying that my
> angles matched POV-Ray's angles.  They didn't quite match.  A close
> view of a POV-Ray icosahedron vertex reveals that it is malformed
> (see PNG in message with same subject, in povray.binaries.images).
> 
> calculated: 52.6226318593503043571428615050624824299049526181
> pov-ray:    52.6625
> 
> calculated: 10.8123169635717062912849447744842228988908330822
> pov-ray:    10.8125
> 
> One of POV-Ray's angles is wrong only in the last digit, but the
> other angle has _three_ wrong digits.
> 

You might want to open an issue at https://github.com/POV-Ray/povray/issues

I made a fix on bugfix/angles-of-platonic-polyhedrons in
https://github.com/LeForgeron/povray.git , to be integrated in hgpovray
in the meantime.


Post a reply to this message

From: William F Pokorny
Subject: Re: Bug report: shapes2.inc icosahedron numerical inaccuracy
Date: 4 Aug 2019 06:42:36
Message: <5d46b69c@news.povray.org>
On 7/22/19 5:01 AM, Le_Forgeron wrote:
> Le 21/07/2019 à 22:53, Robert Munyer a écrit :
> 
...
> You might want to open an issue at https://github.com/POV-Ray/povray/issues
...
> 

I've done this using what Robert posted so we don't lost track of the 
issue. See:

https://github.com/POV-Ray/povray/issues/378

Bill P.


Post a reply to this message

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