-1

I'm not really sure how to phrase this question.

I'm looking for a way to calculate the new X/Y/Z point on the surface of a sphere(which has a known radius) from an known X/Y/Z point where the Y has been increased irrelevantly to the sphere. If I can get the radius of the plane of this Y within the sphere then this would be enough but I'm having a hard time visualizing this.

The closer the Y is to the top of the sphere, the greater the change in the radius. But I'm unsure how to calculate the radius of this circle on the plane within the sphere based only on the radius of the sphere and the height increased from the center.

Visualization

In this image, if the bottom green slab is at Y=0; and the second is at Y=5 and the radius of the sphere is 10, what's the radius of the circle where the top green slab intercepts the circle.

Nico Schertler
  • 32,049
  • 4
  • 39
  • 70
Craftiii4
  • 3
  • 2
  • I'm voting to close this question as off-topic because it is about [math.se] instead of programming or software development. – Pang Feb 25 '16 at 01:41

1 Answers1

0

If your sphere is centered on the origin, you can calculate the planar circle radius at offset y=b by considering the circle at the intersection of the xy plane at the origin. This gives you a circle of radius r. The point (a, b) lying on this circle indicates |a| will be the radius of the intersected circle you want. Using the triangle formed between the x axis and the line between the origin and (a,b), we know that a = r*cos(arcsin(b / r)).

Kurt Stutsman
  • 3,994
  • 17
  • 23
  • Correct. Or - slightly easier - `a = sqrt(r^2 - b^2)`. This lets you find a simpler derivative: `a'(b) = -b / sqrt(r^2 - b^2)`. This formula makes it obvious that the circle decreases faster as the current point approaches the poles. – Nico Schertler Feb 24 '16 at 07:52
  • @NicoSchertler That's what I get for trying to answer a question when half asleep :) You should really post this as an answer. – Kurt Stutsman Feb 24 '16 at 13:59
  • Your answer is fine as it is. My comment was just meant as additional information. – Nico Schertler Feb 24 '16 at 14:41