[Closed] Ring conforms to the circumference of sphere
Hi,
Not a script question per say but a math related one.
Scnario:
- a sphere of radius: 100
- a circle shape of radius: 100
3.I align the circle to the sphere
I want the circle to start with radius 100 and when i take it(or animate) down to the bottom of the sphere(pole) it should zero out in radius.
Ring conforms to the circumference on each step of it’s way down.
What would the math be in this situation.
i could hack this by:
1.At each step along it’s down path(circle Pivot) shoot a ray to the sphere and use the the magnitude to drive the radius.
but that wont further my mathematical understanding of the problem.
Thanks for any help.
b
say
sphRad is the radius of the sphere and
posZ is the distance of the ring when travelling along the axis of the sphere
then the value
squareRoot(sphRadsphRad – posZposZ)
if applied to the radius of the ring, the ring should confirm exactly to the circumference of the sphere.
posZ needs to be evaluated wrt the sphere’s pos.
You could use the math as either an expression or a float script on the radius of the ring.
cheers
Shibu
as far as maths goes in 3D: triangles are king! see my super amazing diagram below
In the above diagram:
r = the radius of the sphere
d = the distance away from the center of the sphere
x = your new radius
so its a simple trig calculation. the old c^2 = a^2 + b^2 or in this case r^2 = d^2 + x^2
so we rearrange the equation so that we can solve for x:
x^2 = r^2 – d^2
[b]x = sqrt (r^2 – d^2)
[/b]EDIT: arg aaaaCHoooo you beat me to it!
Actually both were EXTREMELY helpful.
One was concise and the other visual.
The penny has dropped
b