v0.15.0
Loading...
Searching...
No Matches
sdf.Sphere Class Reference
Collaboration diagram for sdf.Sphere:
[legend]

Public Member Functions

 sDF (r, xc, yc, zc, x, y, z)
 
 gradSdf (xc, yc, zc, x, y, z)
 
 hessSdf (xc, yc, zc, x, y, z)
 
 __init__ (self, Xc, Yc, Zc, diameter)
 
 sDF (self, x, y, z)
 
 gradSdf (self, x, y, z)
 
 hessSdf (self, x, y, z)
 
 __init__ (self, Xc, Yc, Zc, diameter)
 
 sDF (self, x, y, z)
 
 gradSdf (self, x, y, z)
 
 hessSdf (self, x, y, z)
 
 __init__ (self, Xc, Yc, Zc, diameter)
 
 sDF (self, x, y, z)
 
 gradSdf (self, x, y, z)
 
 hessSdf (self, x, y, z)
 

Public Attributes

 Xc = Xc
 
 Yc = Yc
 
 Zc = Zc
 
 xc = Xc
 
 yc = Yc
 
 zc = Zc
 
int radius = diameter/2
 

Detailed Description

Definition at line 141 of file sdf.py.

Constructor & Destructor Documentation

◆ __init__() [1/3]

sdf.Sphere.__init__ ( self,
Xc,
Yc,
Zc,
diameter )

Definition at line 142 of file sdf.py.

142 def __init__(self, Xc, Yc, Zc, diameter):
143 # Initial Centroid
144 self.Xc = Xc
145 self.Yc = Yc
146 self.Zc = Zc
147
148 # Current Centroid
149 self.xc = Xc
150 self.yc = Yc
151 self.zc = Zc
152
153 # Indenter Dimensions
154 self.radius = diameter/2
155

◆ __init__() [2/3]

sdf.Sphere.__init__ ( self,
Xc,
Yc,
Zc,
diameter )

Definition at line 93 of file sdf.py.

93 def __init__(self, Xc, Yc, Zc, diameter):
94 # Initial Centroid
95 self.Xc = Xc
96 self.Yc = Yc
97 self.Zc = Zc
98
99 # Current Centroid
100 self.xc = Xc
101 self.yc = Yc
102 self.zc = Zc
103
104 # Indenter Dimensions
105 self.radius = diameter/2
106

◆ __init__() [3/3]

sdf.Sphere.__init__ ( self,
Xc,
Yc,
Zc,
diameter )

Definition at line 142 of file sdf.py.

142 def __init__(self, Xc, Yc, Zc, diameter):
143 # Initial Centroid
144 self.Xc = Xc
145 self.Yc = Yc
146 self.Zc = Zc
147
148 # Current Centroid
149 self.xc = Xc
150 self.yc = Yc
151 self.zc = Zc
152
153 # Indenter Dimensions
154 self.radius = diameter/2
155

Member Function Documentation

◆ gradSdf() [1/4]

sdf.Sphere.gradSdf ( self,
x,
y,
z )

Definition at line 165 of file sdf.py.

165 def gradSdf(self,x, y, z):
166 a = (x-self.xc)**2 + (y-self.yc)**2 + (z-self.zc)**2
167 c_val = np.sqrt(a)
168 c_val_A = 1./c_val
169 c_val_dx = c_val_A * (x-self.xc)
170 c_val_dy = c_val_A * (y-self.yc)
171 c_val_dz = c_val_A * (z-self.zc)
172 # x, y, z
173 #size = np.size(x)
174 #grad_array = np.empty([size,3])
175 c_val_dx = c_val_dx.reshape((-1,1))
176 c_val_dy = c_val_dy.reshape((-1,1))
177 c_val_dz = c_val_dz.reshape((-1,1))
178 grad_array = np.hstack([c_val_dx,c_val_dy,c_val_dz])
179 return grad_array
180

◆ gradSdf() [2/4]

sdf.Sphere.gradSdf ( self,
x,
y,
z )

Definition at line 110 of file sdf.py.

110 def gradSdf(self, x, y, z):
111 a = (x-self.xc)**2 + (y-self.yc)**2 + (z-self.zc)**2
112 c_val_A = 1./np.sqrt(a)
113 c_val_dx = c_val_A * (x-self.xc)
114 c_val_dy = c_val_A * (y-self.yc)
115 c_val_dz = c_val_A * (z-self.zc)
116 # x, y, z
117 return np.hstack([c_val_dx.reshape((-1,1)), c_val_dy.reshape((-1,1)), c_val_dz.reshape((-1,1))])
118

◆ gradSdf() [3/4]

sdf.Sphere.gradSdf ( self,
x,
y,
z )

Definition at line 165 of file sdf.py.

165 def gradSdf(self,x, y, z):
166 a = (x-self.xc)**2 + (y-self.yc)**2 + (z-self.zc)**2
167 c_val = np.sqrt(a)
168 c_val_A = 1./c_val
169 c_val_dx = c_val_A * (x-self.xc)
170 c_val_dy = c_val_A * (y-self.yc)
171 c_val_dz = c_val_A * (z-self.zc)
172 # x, y, z
173 #size = np.size(x)
174 #grad_array = np.empty([size,3])
175 c_val_dx = c_val_dx.reshape((-1,1))
176 c_val_dy = c_val_dy.reshape((-1,1))
177 c_val_dz = c_val_dz.reshape((-1,1))
178 grad_array = np.hstack([c_val_dx,c_val_dy,c_val_dz])
179 return grad_array
180

◆ gradSdf() [4/4]

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

Definition at line 25 of file sdf.py.

25 def gradSdf(xc, yc, zc, x, y, z):
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))])
28

◆ hessSdf() [1/4]

sdf.Sphere.hessSdf ( self,
x,
y,
z )

Definition at line 181 of file sdf.py.

181 def hessSdf(self,x, y, z):
182 x = x-self.xc
183 y = y-self.yc
184 z = z-self.zc
185 Hxx = -x**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
186 Hzx = -x*z/(x**2 + y**2 + z**2)**(3/2)
187 Hxy = -x*y/(x**2 + y**2 + z**2)**(3/2)
188 Hyy = -y**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
189 Hzy = -y*z/(x**2 + y**2 + z**2)**(3/2)
190 Hzz = -z**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
191 # xx, yx, zx, yy, zy, zz
192 Hxx = Hxx.reshape((-1,1))
193 Hzx = Hzx.reshape((-1,1))
194 Hxy = Hxy.reshape((-1,1))
195 Hyy = Hyy.reshape((-1,1))
196 Hzy = Hzy.reshape((-1,1))
197 Hzz = Hzz.reshape((-1,1))
198 hess_array = np.hstack([Hxx, Hxy, Hzx, Hyy, Hzy, Hzz])
199
200 return hess_array
201
202
203
204# Define Indenters below

◆ hessSdf() [2/4]

sdf.Sphere.hessSdf ( self,
x,
y,
z )

Definition at line 119 of file sdf.py.

119 def hessSdf(self, x, y, z):
120 x, y, z = x-self.xc, y-self.yc, z-self.zc
121 denom = (x**2 + y**2 + z**2)**(3/2)
122 sqrt_denom = np.sqrt(x**2 + y**2 + z**2)
123 Hxx = -x**2/denom + 1/sqrt_denom
124 Hzx = -x*z/denom
125 Hxy = -x*y/denom
126 Hyy = -y**2/denom + 1/sqrt_denom
127 Hzy = -y*z/denom
128 Hzz = -z**2/denom + 1/sqrt_denom
129 # xx, yx, zx, yy, zy, zz
130 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))])
131
132
133# Define Indenters below

◆ hessSdf() [3/4]

sdf.Sphere.hessSdf ( self,
x,
y,
z )

Definition at line 181 of file sdf.py.

181 def hessSdf(self,x, y, z):
182 x = x-self.xc
183 y = y-self.yc
184 z = z-self.zc
185 Hxx = -x**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
186 Hzx = -x*z/(x**2 + y**2 + z**2)**(3/2)
187 Hxy = -x*y/(x**2 + y**2 + z**2)**(3/2)
188 Hyy = -y**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
189 Hzy = -y*z/(x**2 + y**2 + z**2)**(3/2)
190 Hzz = -z**2/(x**2 + y**2 + z**2)**(3/2) + 1/np.sqrt(x**2 + y**2 + z**2)
191 # xx, yx, zx, yy, zy, zz
192 Hxx = Hxx.reshape((-1,1))
193 Hzx = Hzx.reshape((-1,1))
194 Hxy = Hxy.reshape((-1,1))
195 Hyy = Hyy.reshape((-1,1))
196 Hzy = Hzy.reshape((-1,1))
197 Hzz = Hzz.reshape((-1,1))
198 hess_array = np.hstack([Hxx, Hxy, Hzx, Hyy, Hzy, Hzz])
199
200 return hess_array
201
202
203
204# Define Indenters below

◆ hessSdf() [4/4]

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

Definition at line 29 of file sdf.py.

29 def hessSdf(xc, yc, zc, x, y, z):
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
34 Hzx = -x*z/denom
35 Hxy = -x*y/denom
36 Hyy = -y**2/denom + 1/sqrt_denom
37 Hzy = -y*z/denom
38 Hzz = -z**2/denom + 1/sqrt_denom
39 # xx, yx, zx, yy, zy, zz
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))])
41
42

◆ sDF() [1/4]

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

Definition at line 22 of file sdf.py.

22 def sDF(r, xc, yc, zc, x, y, z):
23 return np.sqrt((x - xc)**2 + (y - yc)**2 + (z - zc)**2) - r
24

◆ sDF() [2/4]

sdf.Sphere.sDF ( self,
x,
y,
z )

Definition at line 156 of file sdf.py.

156 def sDF(self, x, y, z):
157 dx = np.subtract(x, self.xc)
158 dy = np.subtract(y, self.yc)
159 dz = np.subtract(z, self.zc)
160 a = (dx)**2+(dy)**2 + (dz)**2
161 gap = np.sqrt(a) - self.radius
162
163 return gap
164

◆ sDF() [3/4]

sdf.Sphere.sDF ( self,
x,
y,
z )

Definition at line 107 of file sdf.py.

107 def sDF(self, x, y, z):
108 return np.sqrt((x - self.xc)**2 + (y - self.yc)**2 + (z - self.zc)**2) - self.radius
109

◆ sDF() [4/4]

sdf.Sphere.sDF ( self,
x,
y,
z )

Definition at line 156 of file sdf.py.

156 def sDF(self, x, y, z):
157 dx = np.subtract(x, self.xc)
158 dy = np.subtract(y, self.yc)
159 dz = np.subtract(z, self.zc)
160 a = (dx)**2+(dy)**2 + (dz)**2
161 gap = np.sqrt(a) - self.radius
162
163 return gap
164

Member Data Documentation

◆ radius

int sdf.Sphere.radius = diameter/2

Definition at line 154 of file sdf.py.

◆ Xc

sdf.Sphere.Xc = Xc

Definition at line 144 of file sdf.py.

◆ xc

sdf.Sphere.xc = Xc

Definition at line 149 of file sdf.py.

◆ Yc

sdf.Sphere.Yc = Yc

Definition at line 145 of file sdf.py.

◆ yc

sdf.Sphere.yc = Yc

Definition at line 150 of file sdf.py.

◆ Zc

sdf.Sphere.Zc = Zc

Definition at line 146 of file sdf.py.

◆ zc

sdf.Sphere.zc = Zc

Definition at line 151 of file sdf.py.


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