|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hi there,
I'm a bit stuck at the moment on a problem that requires some circular
thinking ;)
I have a point A which lies on the circumference of a circle (oriented x-z
like a default torus).
I need point B to lie on the circle as well, but a fixed distance above it.
I have found various solutions using my somewhat dusty trig memory, but they
all fall down in various cases.
If my explanation is a bit vague, render the bit of scene at the end of the
message.
I know the location of the red point. I know the length of the yellow bar.
I can't find the coord for the green point.
(The the red point will never be in such a location that Spot+Bar > Radius)
union{torus{10,0.3} cylinder{-10*x, 10*x, 0.3} cylinder{-10*z, 10*z,
0.3}pigment{color rgb 1}}
sphere{0,1 pigment{color red 1} translate vrotate(10*x, 75*y)}
sphere{0,1 pigment{color green 1} translate vrotate(10*x, 28*y)}
cylinder{0,5*z,0.5 pigment{color rgb<1,1,0>} translate vrotate(10*x, 75*y)}
cylinder{5*z,<5.9,0,5>,0.5 pigment{color rgb<0,0,1>} translate vrotate(10*x,
75*y)}
global_settings{ambient_light color rgb 1}
light_source{<-20, 40, -20> color rgb 1}
camera{location 30*y look_at 0}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Mark Hanford" <pov### [at] hanfordonlinecouk> wrote in
news:3f947734$1@news.povray.org:
> Hi there,
>
> I'm a bit stuck at the moment on a problem that requires some circular
> thinking ;)
>
> I have a point A which lies on the circumference of a circle (oriented
> x-z like a default torus).
> I need point B to lie on the circle as well, but a fixed distance
> above it. I have found various solutions using my somewhat dusty trig
> memory, but they all fall down in various cases.
>
> If my explanation is a bit vague, render the bit of scene at the end
> of the message.
> I know the location of the red point. I know the length of the yellow
> bar. I can't find the coord for the green point.
> (The the red point will never be in such a location that Spot+Bar >
> Radius)
>...
Mark, below is some code for you to play with.
Tor Olav
#version 3.5;
#include "colors.inc"
#declare Radius = 10;
#declare SphRad = 0.5;
#declare CylRad = SphRad/2;
union {
torus { Radius, CylRad }
cylinder { -Radius*x, Radius*x, CylRad }
cylinder { -Radius*z, Radius*z, CylRad }
pigment { color White }
}
#declare pRed = Radius*vrotate(x, 75*y);
#declare YellowLength = 5;
#declare GreenZ = pRed.z + YellowLength;
#declare GreenSin = GreenZ/Radius;
#declare GreenAngle = asin(GreenSin);
#declare GreenX = Radius*cos(GreenAngle);
#declare pGreen = <GreenX, 0, GreenZ>;
#declare pCyan = pRed + YellowLength*z;
sphere { pRed, SphRad pigment { color Red } }
sphere { pGreen, SphRad pigment { color Green } }
sphere { pCyan, SphRad pigment { color Cyan } }
cylinder { pRed, pCyan, CylRad pigment { color Yellow } }
cylinder { pCyan, pGreen, CylRad pigment { color Blue } }
light_source { <-20, 40, -20> color White }
camera {
location 30*y
look_at 0*y
}
background { color Gray30 }
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Tor Olav Kristensen" <tor_olav_kCURLYAhotmail.com> wrote in message
news:Xns### [at] 204213191226...
> "Mark Hanford" <pov### [at] hanfordonlinecouk> wrote in
> news:3f947734$1@news.povray.org:
>
> > I have a point A which lies on the circumference of a circle (oriented
> > x-z like a default torus).
> > I need point B to lie on the circle as well, but a fixed distance
> > above it. I have found various solutions using my somewhat dusty trig
> > memory, but they all fall down in various cases.
> >
>
> Tor Olav
>
> #version 3.5;
>
> #include "colors.inc"
>
> #declare Radius = 10;
> #declare SphRad = 0.5;
> #declare CylRad = SphRad/2;
>
> union {
> torus { Radius, CylRad }
> cylinder { -Radius*x, Radius*x, CylRad }
> cylinder { -Radius*z, Radius*z, CylRad }
> pigment { color White }
> }
>
> #declare pRed = Radius*vrotate(x, 75*y);
>
> #declare YellowLength = 5;
> #declare GreenZ = pRed.z + YellowLength;
> #declare GreenSin = GreenZ/Radius;
> #declare GreenAngle = asin(GreenSin);
> #declare GreenX = Radius*cos(GreenAngle);
> #declare pGreen = <GreenX, 0, GreenZ>;
> #declare pCyan = pRed + YellowLength*z;
>
> sphere { pRed, SphRad pigment { color Red } }
> sphere { pGreen, SphRad pigment { color Green } }
> sphere { pCyan, SphRad pigment { color Cyan } }
>
> cylinder { pRed, pCyan, CylRad pigment { color Yellow } }
> cylinder { pCyan, pGreen, CylRad pigment { color Blue } }
>
> light_source { <-20, 40, -20> color White }
>
> camera {
> location 30*y
> look_at 0*y
> }
>
> background { color Gray30 }
Thank you very much, Tor!
You've done in four lines what I'd already failed at using 20 :) My basic
geometry is rather rusty (why am I using POV again?) and that cripples me
fairly often.
If only I'd listened more at school... (in my defence, that was a while ago)
many thanks
Mark
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
// 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
|
|
| |
| |
|
|
|
|
| |
|
|