POV-Ray : Newsgroups : povray.advanced-users : Sphere placement issues : Sphere placement issues Server Time
28 Jul 2024 20:26:11 EDT (-0400)
  Sphere placement issues  
From: Oldstench
Date: 21 Mar 2004 22:01:01
Message: <e9ls5054rc1rs76j1p493oi862o85vpgrb@4ax.com>
Ok math wizards... 

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 closest I can get is to move the sphere up by twice the radius +
the radius / pi. This is incorrect, however. 

If anyone knows the answer (I know you do!) please not only tell me
what the solution is, but could you explain why? (As long as that is
not too much trouble.)

Here is the test scene:

global_settings {
  assumed_gamma 1
}

#default {
  finish {
    ambient 1
  }
}

#declare mcx = .25;
#declare mcy = .25;

camera {
  orthographic
  location <mcx,mcy,-1>
  look_at <mcx,mcy,0>
  right x*image_width/image_height
  angle 75
}

#declare inter = 0;
#declare rad = 0.25;

#if (inter)
intersection {
#end
  union {
    sphere {
      0, rad
      pigment {
        color rgbt <0,0,1,.7>
      }
    }
    
    sphere {
      0, rad
      pigment {
        color rgbt <0,0,1,.7>
      }
      translate x*rad*2
    }
  }
  
  sphere {
    0, rad
    pigment {
      color rgbt <1,0,0,.7>
    }
    translate <rad, 2*rad - (rad/pi), 0>
  }
#if (inter)
}  
#end

------------------------------------
Thanks


Post a reply to this message

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