POV-Ray : Newsgroups : povray.general : Precision problems? Server Time
23 Nov 2024 16:29:29 EST (-0500)
  Precision problems? (Message 1 to 10 of 10)  
From: Ilya Razmanov
Subject: Precision problems?
Date: 26 Jan 2024 09:09:53
Message: <65b3bd31@news.povray.org>
I have a weird problems with some prisms. Please see the file attached, 
it's tiny example. As you can see, both hexagonal prisms and their 
translations are calculated using school math; moreover, when it comes 
to irrational floats, the same values are used whenever possible via 
declaring the variable, so it have no choice but match. Still, there is 
a gap between objects in vertical direction.

I'm out of ideas regarding the cause of it. Any inspiration?

Ilyich the Tod


Post a reply to this message


Attachments:
Download 'windows-1251' (2 KB)

From: Cousin Ricky
Subject: Re: Precision problems?
Date: 26 Jan 2024 11:05:00
Message: <web.65b3d774284cb76f60e0cc3d949c357d@news.povray.org>
Ilya Razmanov <ily### [at] gmailcom> wrote:
> I have a weird problems with some prisms. Please see the file attached,
> it's tiny example. As you can see, both hexagonal prisms and their
> translations are calculated using school math; moreover, when it comes
> to irrational floats, the same values are used whenever possible via
> declaring the variable, so it have no choice but match. Still, there is
> a gap between objects in vertical direction.
>
> I'm out of ideas regarding the cause of it. Any inspiration?

The geometry of the hexagons is off.  Replacing all occurrences of 0.25 with
revsqrtof3/2 will fix it.


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Precision problems?
Date: 26 Jan 2024 12:11:06
Message: <65b3e7aa$1@news.povray.org>
On 26.01.2024 19:01, Cousin Ricky wrote:

> The geometry of the hexagons is off.  Replacing all occurrences of 0.25 with
> revsqrtof3/2 will fix it.

Damn it. I mean, the most interesting part is that on a piece of paper I 
was drawing it outer radius is marked as "a", while inner (which is 0.5 
in this case) as b, and all the equations are correct. But in POVRay I 
managed to mess with a and b. The most interesting part is, therefore, 
what exactly I was thinking about while moving it from paper to POVRay.

Thank you very much. I'm pretty sure I'd never found this stupid mistake 
myself.

Ilya


Post a reply to this message

From: Kenneth
Subject: Re: Precision problems?
Date: 26 Jan 2024 12:30:00
Message: <web.65b3eba7284cb76f9b4924336e066e29@news.povray.org>
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> Ilya Razmanov <ily### [at] gmailcom> wrote:

> >
> > I'm out of ideas regarding the cause of it. Any inspiration?
>
> The geometry of the hexagons is off.

Yes, that was my guess--although, I didn't know exactly why, so I started
measuring the render visually. The white lines connecting the points should be
equal lengths but are not.

I also superimposed a hexagon diagram from Wikipedia; it shows that the internal
angles are off a bit.


Post a reply to this message


Attachments:
Download 'hexagon_examples_kw.jpg' (60 KB)

Preview of image 'hexagon_examples_kw.jpg'
hexagon_examples_kw.jpg


 

From: Ilya Razmanov
Subject: Re: Precision problems?
Date: 26 Jan 2024 12:42:08
Message: <65b3eef0$1@news.povray.org>
On 26.01.2024 20:28, Kenneth wrote:
> "Cousin Ricky" <rickysttATyahooDOTcom> wrote:
>> Ilya Razmanov <ily### [at] gmailcom> wrote:
> 
>>>
>>> I'm out of ideas regarding the cause of it. Any inspiration?
>>
>> The geometry of the hexagons is off.
> 
> Yes, that was my guess--although, I didn't know exactly why, so I started
> measuring the render visually.

Thanks for illustration. As "Cousin Ricky" explained, I messed internal 
and external diameters in some cases. That is, the values were correct 
but these were correct values of *another* variable. How foolish of me.

Ilya.


Post a reply to this message

From: kurtz le pirate
Subject: Re: Precision problems?
Date: 26 Jan 2024 12:54:18
Message: <65b3f1ca$1@news.povray.org>
On 26/01/2024 17:01, Cousin Ricky wrote:
> Ilya Razmanov <ily### [at] gmailcom> wrote:
>> I have a weird problems with some prisms. Please see the file attached,
>> it's tiny example. As you can see, both hexagonal prisms and their
>> translations are calculated using school math; moreover, when it comes
>> to irrational floats, the same values are used whenever possible via
>> declaring the variable, so it have no choice but match. Still, there is
>> a gap between objects in vertical direction.
>>
>> I'm out of ideas regarding the cause of it. Any inspiration?
> 
> The geometry of the hexagons is off.  Replacing all occurrences of 0.25 with
> revsqrtof3/2 will fix it.
> 
> 

Yes, som error in yours points.

Assuming that the first point of the prism is good : <-0.5,0.25>

We can easily calculate the radius of the center containing the hexagon

sqrt(-0.50*-0.50 + 0.25*0.25) = 0.559017 = r

Calculating all the points gives :
< 0.0000,  0.5590>
< 0.4841,  0.2795>
< 0.4841, -0.2795>
< 0.0000, -0.5590>
<-0.4841, -0.2795>
<-0.4841,  0.2795>

with :
x = r*sin(radians(a));
z = r*cos(radians(a));

'a' is the angle : 0, 60, 120, 180, 240, 300


Drawing these points near your prism give the attached image where the
different positions of the points are clearly visible.


Hope that help





-- 
Kurtz le pirate
Compagnie de la Banquise


Post a reply to this message


Attachments:
Download 'prizm test 3.png' (3 KB)

Preview of image 'prizm test 3.png'
prizm test 3.png


 

From: Ilya Razmanov
Subject: Re: Precision problems?
Date: 26 Jan 2024 14:02:26
Message: <65b401c2@news.povray.org>
On 26.01.2024 20:54, kurtz le pirate wrote:
> 
> Assuming that the first point of the prism is good : <-0.5,0.25>

Assume object is supposed to be centered at 0,0 and have one of the 
sizes 1.0; in this case - inner diameter 1.0. That gives us inner radius 
0.5 and outer radius 2*0.5/sqrt(3), that is that very "revsqrtof3" in 
source text.

As Cousin Ricky guessed, I, being a hodmandod ("Sam, is this a real 
word?"), instead of revsqrtof3/2 wrote 0.5/2, that is, 0.25. That's the 
only reason of the problem - I messed inner and outer. Since the error 
is pretty irrational (even more irrational than sqrt(3)), I'm unlikely 
to find it ever. Fortunately people here found the problem.

Oh, and why someone relatively sane may want a hexagonal prism have an 
inner diameter of 1.0? To do pictures like attached easily, of course.

Ilyich the Toad


Post a reply to this message


Attachments:
Download 'p6.png' (320 KB)

Preview of image 'p6.png'
p6.png


 

From: William F Pokorny
Subject: Re: Precision problems?
Date: 26 Jan 2024 16:58:45
Message: <65b42b15$1@news.povray.org>
On 1/26/24 14:02, Ilya Razmanov wrote:
> To do pictures like attached easily, of course.

I especially like the look of this one. Cool.

Bill P.


Post a reply to this message

From: Ilya Razmanov
Subject: Re: Precision problems?
Date: 27 Jan 2024 12:08:26
Message: <65b5388a$1@news.povray.org>
On 27.01.2024 0:58, William F Pokorny wrote:

> I especially like the look of this one. Cool.
> 
> Bill P.

Well, finally added this one to a collection of similar image to POV 
converters at:

https://github.com/Dnyarri/POVmosaic

Taking into account their number and a possibility to tune resulting POV 
files, it should be sufficient for creating funny posters, postcards, 
greetings and so on for quite some time ;-)

Ilyich the Toad


Post a reply to this message

From: tTh
Subject: Re: Precision problems?
Date: 27 Jan 2024 17:33:52
Message: <65b584d0$1@news.povray.org>
On 1/26/24 20:02, Ilya Razmanov wrote:

> Oh, and why someone relatively sane may want a hexagonal prism have an 
> inner diameter of 1.0? To do pictures like attached easily, of course.

    Well done, bro !

-- 
+---------------------------------------------------------------------+
|          https://tube.interhacker.space/a/tth/video-channels        |
+---------------------------------------------------------------------+


Post a reply to this message

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