v0.14.0
Public Member Functions | List of all members
sdf_sphere.Sphere Class Reference

Public Member Functions

def sDF (r, xc, yc, zc, x, y, z)
 
def gradSdf (xc, yc, zc, x, y, z)
 
def hessSdf (xc, yc, zc, x, y, z)
 

Detailed Description

Definition at line 20 of file sdf_sphere.py.

Member Function Documentation

◆ gradSdf()

def sdf_sphere.Sphere.gradSdf (   xc,
  yc,
  zc,
  x,
  y,
  z 
)

Definition at line 29 of file sdf_sphere.py.

29  def gradSdf(xc, yc, zc, x, y, z):
30  a = (x-xc)**2 + (y-yc)**2 + (z-zc)**2
31  c_val = np.sqrt(a)
32  c_val_A = 1./c_val
33  c_val_dx = c_val_A * (x-xc)
34  c_val_dy = c_val_A * (y-yc)
35  c_val_dz = c_val_A * (z-zc)
36 
37  c_val_dx = c_val_dx.reshape((-1,1))
38  c_val_dy = c_val_dy.reshape((-1,1))
39  c_val_dz = c_val_dz.reshape((-1,1))
40  grad_array = np.hstack([c_val_dx,c_val_dy,c_val_dz])
41  return grad_array
42 

◆ hessSdf()

def sdf_sphere.Sphere.hessSdf (   xc,
  yc,
  zc,
  x,
  y,
  z 
)

Definition at line 43 of file sdf_sphere.py.

43  def hessSdf(xc, yc, zc, x, y, z):
44  x = x-xc
45  y = y-yc
46  z = z-zc
47  Hxx = -x**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
48  Hzx = -x*z/(x**2 + y**2 + z**2)**(3/2)
49  Hxy = -x*y/(x**2 + y**2 + z**2)**(3/2)
50  Hyy = -y**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
51  Hzy = -y*z/(x**2 + y**2 + z**2)**(3/2)
52  Hzz = -z**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
53  # xx, yx, zx, yy, zy, zz
54  Hxx = Hxx.reshape((-1,1))
55  Hzx = Hzx.reshape((-1,1))
56  Hxy = Hxy.reshape((-1,1))
57  Hyy = Hyy.reshape((-1,1))
58  Hzy = Hzy.reshape((-1,1))
59  Hzz = Hzz.reshape((-1,1))
60  hess_array = np.hstack([Hxx, Hxy, Hzx, Hyy, Hzy, Hzz])
61 
62  return hess_array
63 
64 
65 
66 
67 

◆ sDF()

def sdf_sphere.Sphere.sDF (   r,
  xc,
  yc,
  zc,
  x,
  y,
  z 
)

Definition at line 21 of file sdf_sphere.py.

21  def sDF(r, xc, yc, zc, x, y, z):
22  dx = np.subtract(x, xc)
23  dy = np.subtract(y, yc)
24  dz = np.subtract(z, zc)
25  a = dx**2 + dy**2 + dz**2
26  gap = np.sqrt(a) - r
27  return gap
28 

The documentation for this class was generated from the following file: