|
![](/i/fill.gif) |
Daniel Sullivan wrote:
>
> Hi there-
>
> I'm trying to create a 'screen' for my povray bong using tori.
> At the same time I'm trying learn how to use povrays programming
> directives so I do'nt have to write so many lines of code.
> I'm including the code I've already written so you can see what I'm
> attempting to do.
>
> / Persistence of Vision Ray Tracer Scene Description File
> // File:screen.pov
> // Vers: 3.1
> // Desc: screen created with tori
> // Date: 8/20/98
> // Auth: ArfGrafix
>
> // ==== Standard POV-Ray Includes ====
> #include "colors.inc" // Standard Color definitions
> #include "textures.inc" // Standard Texture definitions
> #include "metals.inc"
>
> // Set a color of the background (sky)
> background { White }
>
> camera
> {
> location <0.0 , 2.0 ,-5.0>
> look_at <0.0 , 0.0 , 0.0>
> }
>
> // create a regular point light source
> light_source
> {
> 0*x // light's position (translated below)
> color red 1.0 green 1.0 blue 1.0 // light's color
> translate <-20, 40, -20>
> }
>
> #declare b_ring =
> torus { 2, .0625 pigment { P_Brass3 } finish { F_MetalC } }
>
> object { b_ring scale .9 translate .1*y }
> object { b_ring scale .8 translate .2*y }
> object { b_ring scale .7 translate .3*y }
> object { b_ring scale .6 translate .4*y }
> object { b_ring scale .5 translate .5*y }
> object { b_ring scale .4 translate .6*y }
> object { b_ring scale .3 translate .7*y }
> object { b_ring scale .2 translate .8*y }
> object { b_ring scale .1 translate .9*y }
>
> I wrote this piece of code and soon found out that this creates a
> conical series of tori...I tried making a while loop to do this, but was
> flummoxed by the task of having the while do two different operations.
> What I want is series of tori that form a hemisphere rather than a
> cone..that is each torus is a latitudinal strip that trace out a
> hemisphere.
> Thanks in advance for any helpful input that anyone may have.
>
> Best regards,
>
> Ron Hicks
> sig### [at] hotmail com
> http://www.geocities.com/SoHo/1006
First point, do you want the thickness of the ring to decrease as the
height increases? This is what scaling the object is doing. If not then
try
union
{
#declare a = .1 #while(a < 1)
torus { cos(asin(a)),.04 translate y*a }
#declare a = a+.1 #end
pigment { P_Brass3 }
finish { F_MetalC }
}
Note I made the minor radius a bit smaller since it's not being scaled.
On a circle drawn on the XY plane, X is proportional to cos(a) and Y is
proportional to sin(a) so you can derive the angle by asin(a), then get
the X (or major radius in this case) by cos(asin(a)).
If you do want the same as you had but a hemispherical version try
#declare a = .1 #while(a < 1)
object{b_ring scale cos(asin(a)) translate y*a }
#declare a = a+.1 #end
Hope this helps.
Cheers, PoD.
Post a reply to this message
|
![](/i/fill.gif) |