POV-Ray : Newsgroups : povray.newusers : Stuck with circle-maths : Re: Stuck with circle-maths Server Time
30 Jul 2024 18:10:33 EDT (-0400)
  Re: Stuck with circle-maths  
From: Tor Olav Kristensen
Date: 20 Oct 2003 20:44:18
Message: <Xns941B1BD7940E6torolavkhotmailcom@204.213.191.226>
"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

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