POV-Ray : Newsgroups : povray.binaries.images : well [49.7kb] : Re: well [49.7kb] Server Time
15 Aug 2024 06:10:42 EDT (-0400)
  Re: well [49.7kb]  
From: Mike Williams
Date: 25 Jul 2002 15:15:04
Message: <4W9loOAw3EQ9Ewrj@econym.demon.co.uk>
Wasn't it marabou who wrote:
>
>on disk i found a piece of a scene i made long time ago. it is a macro 
>which makes a floor, a wall and a well. the well part of macro is buggy as 
>everyone can see. that is because i have no solution for the question: on a 
>defined stone and a nearly given radius how many complete stones can be 
>positioned to fill a circle and how great is radius then? is there a 
>formular i can use? for help i would be appreciated.

I'd attack it like this:

The interior faces of the bricks form a regular N-gon with the side
equal to the length of the brick. Determine the sizes of regular N-gons
with unit size and pick the one that most nearly matches the given
radius.

Let's call the distance from the centre of the circle to the midpoint of
an edge "R". (It's not a true radius, particularly in cases where N is
odd).

We know that the sum of the angles at the centre is 2*Pi, and that the
N-gon is regular, so each edge subtends an angle of 2*Pi/N at the
centre.

Lets draw a right angled triangle connecting the centre of the circle,
the centre of an edge and an adjacent vertex. We can see that the angle
at the centre is Pi/N, and it's tangent is 0.5/R (opposite over
adjacent), so

        tan(pi/N) = 0.5/R

i.e.

        R = 1/(2*tan(pi/N))


So

#declare N=3;
#while (1/(2*tan(pi/N)) < given_radius)
  #declare N=N+1;
#end
#declare R = 1/(2*tan(pi/N));

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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