POV-Ray : Newsgroups : povray.newusers : Stuck with circle-maths : Re: Stuck with circle-maths Server Time
2 Nov 2024 17:22:01 EDT (-0400)
  Re: Stuck with circle-maths  
From: Mark Hanford
Date: 21 Oct 2003 05:12:00
Message: <3f94f860$1@news.povray.org>
"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

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