v0.14.0
Public Member Functions | List of all members
sdf_flat.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 37 of file sdf_flat.py.

Member Function Documentation

◆ gradSdf()

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

Definition at line 46 of file sdf_flat.py.

46  def gradSdf(xc, yc, zc, x, y, z):
47  a = (x-xc)**2 + (y-yc)**2 + (z-zc)**2
48  c_val = np.sqrt(a)
49  c_val_A = 1./c_val
50  c_val_dx = c_val_A * (x-xc)
51  c_val_dy = c_val_A * (y-yc)
52  c_val_dz = c_val_A * (z-zc)
53 
54  c_val_dx = c_val_dx.reshape((-1,1))
55  c_val_dy = c_val_dy.reshape((-1,1))
56  c_val_dz = c_val_dz.reshape((-1,1))
57  grad_array = np.hstack([c_val_dx,c_val_dy,c_val_dz])
58  return grad_array
59 

◆ hessSdf()

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

Definition at line 60 of file sdf_flat.py.

60  def hessSdf(xc, yc, zc, x, y, z):
61  x = x-xc
62  y = y-yc
63  z = z-zc
64  Hxx = -x**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
65  Hzx = -x*z/(x**2 + y**2 + z**2)**(3/2)
66  Hxy = -x*y/(x**2 + y**2 + z**2)**(3/2)
67  Hyy = -y**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
68  Hzy = -y*z/(x**2 + y**2 + z**2)**(3/2)
69  Hzz = -z**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
70  # xx, yx, zx, yy, zy, zz
71  Hxx = Hxx.reshape((-1,1))
72  Hzx = Hzx.reshape((-1,1))
73  Hxy = Hxy.reshape((-1,1))
74  Hyy = Hyy.reshape((-1,1))
75  Hzy = Hzy.reshape((-1,1))
76  Hzz = Hzz.reshape((-1,1))
77  hess_array = np.hstack([Hxx, Hxy, Hzx, Hyy, Hzy, Hzz])
78 
79  return hess_array
80 
81 

◆ sDF()

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

Definition at line 38 of file sdf_flat.py.

38  def sDF(r, xc, yc, zc, x, y, z):
39  dx = np.subtract(x, xc)
40  dy = np.subtract(y, yc)
41  dz = np.subtract(z, zc)
42  a = dx**2 + dy**2 + dz**2
43  gap = np.sqrt(a) - r
44  return gap
45 

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