# Create a sphere that intersects another at right angles

This topic is 2396 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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?

##### Share on other sites
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.

##### Share on other sites
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?

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
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):

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.

##### Share on other sites

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.

• 16
• 9
• 13
• 41
• 15