POV-Ray : Newsgroups : povray.general : Precision problems? : Re: Precision problems? Server Time
14 Apr 2024 04:34:30 EDT (-0400)
  Re: Precision problems?  
From: kurtz le pirate
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


 

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