12def sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
13 return Sphere.sDF(R, xc, yc, zc, x, y, z)
15def grad_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
16 return Sphere.gradSdf(xc, yc, zc, x, y, z)
18def hess_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
19 return Sphere.hessSdf(xc, yc, zc, x, y, z)
22 def sDF(r, xc, yc, zc, x, y, z):
23 return np.sqrt((x - xc)**2 + (y - yc)**2 + (z - zc)**2) - r
26 c_val_A = 1./np.sqrt((x-xc)**2 + (y-yc)**2 + (z-zc)**2)
27 return np.hstack([(c_val_A * (x-xc)).reshape((-1,1)), (c_val_A * (y-yc)).reshape((-1,1)), (c_val_A * (z-zc)).reshape((-1,1))])
30 x, y, z = x-xc, y-yc, z-zc
31 denom = (x**2 + y**2 + z**2)**(3/2)
32 sqrt_denom = np.sqrt(x**2 + y**2 + z**2)
33 Hxx = -x**2/denom + 1/sqrt_denom
36 Hyy = -y**2/denom + 1/sqrt_denom
38 Hzz = -z**2/denom + 1/sqrt_denom
40 return np.hstack([Hxx.reshape((-1,1)), Hxy.reshape((-1,1)), Hzx.reshape((-1,1)), Hyy.reshape((-1,1)), Hzy.reshape((-1,1)), Hzz.reshape((-1,1))])
gradSdf(xc, yc, zc, x, y, z)
hessSdf(xc, yc, zc, x, y, z)
sDF(r, xc, yc, zc, x, y, z)
hess_sdf(t, x, y, z, tx, ty, tz)
grad_sdf(t, x, y, z, tx, ty, tz)