|
|
// Hi Mark,
//
// no trig is neccessary, only Pythagoras,
// as you can see in the following scene!
//
// Sputnik
// parameters of the problem
#declare Radius = 10;
#declare RedAngle = 75;
#declare Dist = 5; // or whatever
// find coordinates of position of red point
#declare RedPoint = vrotate ( Radius*x, RedAngle*y );
#declare RedX = RedPoint.x;
#declare RedZ = RedPoint.z;
// calculate z of green point
#declare GreenZ = RedZ+Dist;
// calculate x of green point
// (Pythagoras in triangle <0,0,0>, <GreenX,0,0>, <GreenX,0,GreenZ>)
#declare GreenXsquared = Radius*Radius - GreenZ*GreenZ;
#if (GreenXsquared>=0)
#declare GreenX = sqrt( GreenXsquared );
// -GreenX also is a solution
#else
// no solution
#error "No solution possible!\n"
#end
#declare GreenPoint = <GreenX, 0, GreenZ>;
#declare CylJunction = <RedX , 0, GreenZ>;
// draw everything
union {
torus { Radius, 0.3 }
cylinder { -Radius*x , Radius*x, 0.3 }
cylinder { -Radius*z , Radius*z, 0.3 }
cylinder { GreenPoint, 0 , 0.3 }
cylinder { GreenPoint, GreenX*x, 0.3 }
pigment { color rgb 1 }
}
sphere { RedPoint , 1 pigment { color red 1 } }
sphere { GreenPoint, 1 pigment { color green 1 } }
cylinder { RedPoint , CylJunction, 0.5 pigment { color rgb <1,1,0> } }
cylinder { GreenPoint, CylJunction, 0.5 pigment { color blue 1 } }
// look at all this
light_source { <-20, 40, -20> color rgb 1 }
camera { location 30*y look_at 0 }
// that's all!
Post a reply to this message
|
|