POV-Ray : Newsgroups : povray.advanced-users : Sphere placement issues : Re: Sphere placement issues Server Time
28 Jul 2024 20:22:33 EDT (-0400)
  Re: Sphere placement issues  
From: Oldstench
Date: 22 Mar 2004 19:28:47
Message: <k21v5051frudv40pq8do6mhn01nvr5tasf@4ax.com>
On Mon, 22 Mar 2004 12:44:55 +0100, Mark Weyer
<wey### [at] informatikuni-freiburgde> wrote:

>> This scene is just a test of pyramidal sphere structures, but I am
>> having a small issue. If I want the topmost sphere to appear as if it
>> is laying on top of the 4 sphere base, what kind of math do I need to
>> do to get the sphere to be placed in exactly the right position
>> vertically?
>
>The solution is: Pythagoras
>
>I will assume sphere radii of 1.
>
>Your scene suggests that you want 2 base spheres at positions <0,0,0>
>and <2,0,0>. Then the third must be at <1,y,0>, where y is such that
>the spheres touch. The do touch, if they are exactly 2 apart, that is
>if (1-0)^2+(y-0)^2=2^2, or, equivalently, y=sqrt(3).
>
>If you want, like Christopher James assumes, 3 base spheres, then you
>want to place those as above, but in the xz-plane, that is as positions
><0,0,0>, <2,0,0>, and <1,0,sqrt(3)>. Now before we look for the fouth
>sphere, let us find the center of the triangle formed by the three
>spheres so far. It will be <1,0,z> for some z, so that is is equally
>far apart from each of the first two spheres. The requirement for being
>as far apart in turn from the third sphere is
>   (1-0)^2+(z-0)^2 = (1-1)^2+(sqrt(3)-z)^2
>that is
>   1+z^2 = 3-2*sqrt(3)*z+z^2
>that is
>   2*sqrt(3)*z = 2
>that is
>   z = sqrt(3)/3
>The forth sphere must be above this center, so it has coordinates
><1,y,sqrt(3)/3>. Now we are looking for y such that the distance from
>the other 3 spheres (say the first) is 2, that is
>   (1-0)^2+(y-0)^2+(sqrt(3)/3)^2=2^2
>that is
>   1+y^2+1/3=4
>that is
>   y^2=8/3
>that is
>   y=sqrt(8/3)
>
>If you want, like the term pyramid suggests, 4 base spheres, then
>these will be at positions <0,0,0>, <2,0,0>, <0,0,2>, and <2,0,2>. The
>fifth sphere will be at <1,y,1> such that its distance from the first
>is 2, that is (1-0)^2+(y-0)^2+(1-0)^2=2^2, that is y^2=2, that is
>y=sqrt(2).
>
>Be aware of computational flaws I might have made.

Thanks a lot! I really appreciate this, and now I will dust my
Geometry 101 section of my brain off and put this info to work.


Post a reply to this message

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