11 def sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
12 return Sphere.sDF(R, xc, yc, zc - d * t, x, y, z)
14 def grad_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
15 return Sphere.gradSdf(xc, yc, zc - d * t, x, y, z)
17 def hess_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
18 return Sphere.hessSdf(xc, yc, zc - d * t, x, y, z)
21 def sDF(r, xc, yc, zc, x, y, z):
22 return np.sqrt((x - xc)**2 + (y - yc)**2 + (z - zc)**2) - r
25 c_val_A = 1./np.sqrt((x-xc)**2 + (y-yc)**2 + (z-zc)**2)
26 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))])
29 x, y, z = x-xc, y-yc, z-zc
30 denom = (x**2 + y**2 + z**2)**(3/2)
31 sqrt_denom = np.sqrt(x**2 + y**2 + z**2)
32 Hxx = -x**2/denom + 1/sqrt_denom
35 Hyy = -y**2/denom + 1/sqrt_denom
37 Hzz = -z**2/denom + 1/sqrt_denom
39 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))])