POV-Ray Resting object

122 Views Asked by At

I have a cone created in POV-Ray with

torus { 8, 4 texture { pigment { Purple } } translate <0, .... , 0> 
cone {  <0, 0, 0> 5 <0, 5, 0> 0  texture { pigment { Brown }  } }

I'm trying to make the torus "rest" on top of the cone. How would I calculate the value needed to do such a thing?

1

There are 1 best solutions below

0
On

I assume that the desired result is a torus that "fits" the cone like a belt. Provided that torus_major_radius - torus_minor_radius >= cone_base_radius, the proper code would be (feel free to play with the values):

#declare MAJOR = 2;
#declare MINOR = 0.2;
#declare CONE_HEIGHT = 10;
#declare CONE_RADIUS = 3;

cone  {
    <0, CONE_HEIGHT, 0>, 0,
    <0, 0, 0>, CONE_RADIUS
    pigment {color Green}
}

torus  {
    MAJOR, MINOR
    pigment {color Yellow}
    translate y * CONE_HEIGHT * (1 - (MAJOR - MINOR) / CONE_RADIUS)
}

This will produce the following result:

enter image description here