# How can I calculate a 28.5 mm hole for a hyperboloid center opening when it's Z=0

How can I calculate a 28.5 mm hole for a hyperboloid center opening when it's Z is equal to 0

The arrows point to where z=0 and the 28.5mm hole should be. (I know I could scale the object but I need to use the formula to animate other values)

I'm using animation nodes and python to animate it see attached file

import bpy
import math

def parametricfunc(uval_a, uval_b, zaxis_a, zaxis_b, num_x, num_y):

# mesh arrays
verts = []
faces = []

# mesh variables
#num_x = 40
#num_y = 40

pi = math.pi
PHI = (1+math.sqrt(5))/2 #1.61803398874989
phi = (1+math.sqrt(5))/2-1 #0.61803398874989
rmse_PHI = PHI * math.sqrt(0.5) # 0.707*PHI =1.144
rmse_phi = phi * math.sqrt(0.5) # 0.707*phi
golden_angle_deg_bg = 360-golden_angle_deg_sm #222.492235949962

#print("type ux=%s" % (type(frame)))

# fill verts array
for i in range (0, num_x):
for j in range(0,num_y):
# nomalize range

u = 8*(i/num_x-1/2)
v = 2*math.pi*(j/(num_y-1)-1/2)

x = 2*math.sqrt(1+u*u)*math.cos(v)*(uval_a/12)
y = 2*math.sqrt(1+u*u)*math.sin(v)*(uval_a/12)
z = uval_b*(u)

vert = (x,y,z)
verts.append(vert)

#print("type verts=%s" % (type(vert)))

# fill faces array
count = 0
for i in range (0, num_y *(num_x-1)):
if count < num_y-1:
A = i
B = i+1
C = (i+num_y)+1
D = (i+num_y)
face = (A,B,C,D)
faces.append(face)
count = count + 1
else:
count = 0

return x, y, z, verts, A, B, C, D, faces, edges, polys

x, y, z, verts, A, B, C, D, faces, edges, polys  = parametricfunc(uval_a, uval_b, zaxis_a, zaxis_b, num_x, num_y)


• Could you explain a bit more why you're calculating it like that? Do you want to change the algorithm or to find the good input values? Oct 17 '20 at 8:07
• In general you need to find the local minimum of your hyperbola function, which correlates to a certain z (or j) in your case. Lots of examples online. Make sure the function actually places a vertex at that position. Oct 17 '20 at 8:16
• @lemon I needed to use the parametric equation it allows for easier animation values (x,y,z) with animation nodes and python mathworld.wolfram.com/One-SheetedHyperboloid.html Oct 17 '20 at 8:37
• Or parametric for this hyperbola part: x = a * sqrt(1 + u**2) and z = c * u. Oct 17 '20 at 9:02
• ok, have added an answer considering the diameter as input. => uval_a / 2 Oct 17 '20 at 9:30

If you want to input the radius here:

You can change your code by:

for i in range (0, num_x):
for j in range(0,num_y):
# nomalize range

u = 8*(i/num_x-1/2)
v = 2*math.pi*(j/(num_y-1)-1/2)

x = math.sqrt(1+u*u)*math.cos(v)*uval_a/2
y = math.sqrt(1+u*u)*math.sin(v)*uval_a/2
z = uval_b*u

vert = (x,y,z)
verts.append(vert)


As explained here

The base equation is:

$$\frac{x^2}{a^2} - \frac{y^2}{b^2} = 1$$

Which gives:

$$y = \pm \frac{b}{a} \sqrt{x^2 - a^2}$$

When a and b are defined by: