# How to calculate movement of a radius of one sphere to intersect another sphere and create a specified distance for the intersection

Attached is a diagram and a picture of my current model and a GIF image what I'm trying to achieve.

Sketch:

Screenshot:

Details:

The inner circle is a perfect sphere with a radius of 6.63

The outer circle the bottom half is from a perfect sphere with a radius of 12. The top half had a radius of 12 as well but was reduced 90% in the Z direction. This is to simulate how an eye is not perfectly spherical.

Gif Image Showing My Goal:

The image above shows me taking the inner sphere and raising it out of the other sphere. This will create the 'cornea' of the eye I plan on modeling later. I can then use the modifier boolean to union them together at a later time.

The Question:

I'm doing this for 3D Printing and medical purposes so the dimensions need to be exact. How do I raise the inner sphere so that it will intersect the other sphere and create a 12 distance once it's outside. In the GIF image I uploaded you can see I was off in my attempt to raise it and I only guessed with a measuring tool what created the 12 distance.

Put another way the points where the circumference of the inner circle touch the circumference of the outer circle should create a distance of 12. In my diagram it's the dashed line that says 12.

What is the best way to go about this so it's pixel perfect? (as much as possible)

• planetcalc.com/1421 – susu Jul 3 at 6:21
• Good find, I'm starting to think this may be more of a math problem then blender issue possibly. – Joseph Astrahan Jul 3 at 6:53
• Indeed, the issue is not about the tools but having the concept clear. – susu Jul 3 at 6:56
• Good thing I'm a math major... Place the center of the small sphere at 6.53228. I'll write up a proper answer in a few minutes. – Ron Jensen Jul 3 at 7:05
• Yeah you are right that is the right answer :). I got 6.57 as the answer that seems to work and create exactly 12 which is very close to yours. I just did it by manually moving for now but curious the exact way to do it. – Joseph Astrahan Jul 3 at 7:40

We'll start with the 12 mm radius sphere, note the 12mm chord is in the XY plane, so scaling on the Z axis won't change its size, it will only move the position in the Z direction. Because we can draw a right triangle with hypotenuse 12 (the radius) and leg 6 (half the chord length) we know the remaining side is $$6\sqrt{3}$$. When we squish the sphere by 90% that side will also squish, so the red dot winds up at $$0.9 \cdot 6\sqrt{3}$$

Moving onto the smaller, 6.63 mm sphere, we can again draw a right triangle, this time with hypotenuse 6.63 but still with a leg of 6. We need to resort to the distance formula $$k = \sqrt{6.63^2 - 6^2}$$ to find the side length because this triangle wasn't special like the last one.

To position the red dots on top of each other, we need to move the green dot so it is in the right place below the red dot: $$\textrm{green dot} = 0.9 \cdot 6\sqrt{3} - \sqrt{6.63^2 - 6^2}$$

The final result.

• Hi Ron! Welcome to the community. A nice and precise answer. Nothing unnecessarry, straight to the point. I like it! – Teck-freak Jul 3 at 8:42

Bmesh version

Make a radius 1 eyeball with a 0.5 radius aperture to fit a 0.5525 radius cornea. _ie to get question dimensions scale by 12.

As per question eye faces in Z direction blender usually uses -Y to face camera in front view

eye_angle is the angle above horizontal to cut aperture.

cornea_angle is half angle of opening

Create a vert at back of eye (0, 0, -1) and spin it around 90 + eye_angle degrees.

Scale any vertex coordinates in "front half of eye by front_half_scale

The last created vert will be on the aperture. It will have a z coordinate where to place the cornea lens

Similarly get the angle that the aperture latitude will be for the smaller cornea placed at origin, drop it such that chord is at zero then move up to place lens over eye hole.

I

Image shows on left the edges created before the final full spin around Z. As commented in code, could skip last step and instead use as a profile to revolve via the screw modifier

Could also be done via the make maths surface by defining the equation scribing based on our ruleset

Test code,

import bpy
import bmesh
from math import radians, acos, asin, sin, cos

context = bpy.context
coll = context.collection

# inputs
#####################################
aperture = 0.5
front_half_scale = 0.9
cornea_radius = 0.5525 # 6.63 / 12
#####################################

eye_angle = acos(aperture)

bm = bmesh.new()
vs = bm.verts.new((0, 0, -1))
bmesh.ops.spin(
bm,
geom=[vs],
axis=(0, -1, 0),
steps=16,
)
bmesh.ops.scale(
bm,
verts=[v for v in bm.verts if v.co.z > 0],
vec=(1, 1, front_half_scale),
)

bm.verts.ensure_lookup_table()
vc = bm.verts[-1]
vc.select_set(True)

bmesh.ops.spin(
bm,
geom=[vc],
angle=cornea_angle,
axis=(0, -1, 0),
cent=(0, 0, vc.co.z - cornea_radius * cos(cornea_angle)),
steps=8,
)

# remove this and use screw modifier instead
bmesh.ops.spin(
bm,
geom=bm.verts[:] + bm.edges[:],
axis=(0, 0, 1),
steps=32,
use_merge=True,
)

bmesh.ops.remove_doubles(
bm,
verts=bm.verts,
dist=1e-5,
)

me = bpy.data.meshes.new("Eye")
bm.to_mesh(me)
ob = bpy.data.objects.new("Eye", me)