Create a sphere that intersects another at right angles

Started by
8 comments, last by alvaro 12 years, 5 months ago
I need to find the center and radius of a 3D cartesian sphere that intersects another sphere at right angles. Illustration:

[attachment=5946:Circles.png]

Knowns:
* Center of the blue sphere, which is centered at the origin in fact (0,0,0)
* Radius of the blue sphere
* Axis along which the center of the red sphere lies (also intersection point of the axis with the blue sphere)
* Distance between the two red dots


Basically the blue sphere is Earth and I need to generate a cartesian sphere representing a circle on the surface of the Earth. I've done this already except that my circles are centered on the Earth's surface (red dot) which means they don't intersect the ground at right angles like the red circle roughly does. This causes certain math routines to fail. So I need to find the center/radius of the red circle drawn in the illustration.

I know that, on a 2D picture, if you draw tangents of the blue circle where the red circle intersects it, the intersection of those two tangents marks the center of the red circle. Still don't know how to correlate this with the above 3D inputs to find what I need.

Can anyone help?
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
Advertisement
If the tangent lines make an angle of 90 degrees, than so do the vectors from the centers of the circles to the points where they intersect. Using this it should be pretty easy to solve.
I still can't come up with a solution. Remember that are an infinite number of points where the two spheres intersect because this is 3D. How do I find the 3D cartesian center and radius of the red sphere given its center axis (relative to the blue sphere's center) and the radius of the intersection circle?
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
There is a solution for all red radii. So just pick any valid intersection point (0 degrees to 90 degrees from the axis-line) and solve using quasar3d's observation that the center-to-intersection lines are tangent.

I'm not heavy math-oriented, but I'm guessing the function will boil down to a single trig relation.

(edit) if you know the radius of the 3d intersection circle, you know where the equivalent intersection point is in the 2D case, and can solve it the same way.
You know how to solve the problem in 2D, and this is essentially a 2D problem. Just consider any plane that contains the axis where the red center is known to be, and solve the problem there.
Speed matters and getting the intersection of two 3D vectors constrained to some arbitrary plane does not seem like the correct solution. There must be a more direct way.
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
Wait, I think I can utilize what quasar3d noted about there being a right triangle from the earth's center, the red sphere's center, and a tangent point. I was thinking I only knew one side (earth's radius) and one angle (90 at the tangent) but of course I can calculate the angle at the Earth's center, and then that would be enough information to invoke Pythagorean.

And I already know that angle since it's trivial to calculate given the radius of the intersection circle along the Earth's surface; you just divide by the Earth's radius and that gives you radians.
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
I meant you can think of the problem as a 2D problem and do the Math that way. The actual computation is something like this (untested):
float d = distance_between_red_points / radius_of_blue_sphere;
Point3D center_of_red_sphere = center_of_blue_sphere + axis_direction * (radius_of_blue_sphere * d / (2.0-d*d));


It doesn't get much faster than that.
The solution I've come up with is, since as an input I have the circle's radius along the surface of the Earth (not straight-line radius):

sphereRadius = earthRadius * tan(circleRadius / earthRadius);
sphereCenterDistance = sqrt( earthRadius^2 + sphereRadius^2 );

CircleRadius / EarthRadius gives the radians of the arc covered by the circle (or half of it since this is radius and not diameter). sphereCenterDistance is the distance along the center axis where the sphere's center lies. So with those two things I have my sphere. I would assume any solution that does not involve trigonometric functions would be wrong; maybe you just hadn't realized my circle's radius is measured along the Earth's surface.
~CGameProgrammer( );Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.

I would assume any solution that does not involve trigonometric functions would be wrong; maybe you just hadn't realized my circle's radius is measured along the Earth's surface.


That is what happened. "The distance between the red dots" doesn't say anything about following the blue sphere's surface.

This topic is closed to new replies.

Advertisement