v0.14.0
Loading...
Searching...
No Matches
sdf_plane_2d.py
Go to the documentation of this file.
1import math
2import numpy as np
3
4d = 0.00159624 # indentation depth
5
6xc = 0
7yc = 0
8zc = 0
9
10def sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
11 return yPlane.sDF(xc, yc - d * t, zc, x, y, z)
12
13def grad_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
14 return yPlane.gradSdf(xc, yc - d * t, zc, x, y, z)
15
16def hess_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id):
17 return yPlane.hessSdf(xc, yc - d * t, zc, x, y, z)
18
19class yPlane:
20 def sDF(xc, yc, zc, x, y, z):
21 return np.subtract(yc, y)
22
23 def gradSdf(xc, yc, zc, x, y, z):
24 dx = np.zeros_like(x).reshape((-1, 1))
25 dy = np.full_like(y, -1).reshape((-1, 1))
26 dz = np.zeros_like(z).reshape((-1, 1))
27 return np.hstack([dx, dy, dz])
28
29 def hessSdf(xc, yc, zc, x, y, z):
30 zeros = np.zeros_like(x).reshape((-1, 1))
31 return np.hstack([zeros for _ in range(6)]) # xx, yx, zx, yy, zy, zz
hessSdf(xc, yc, zc, x, y, z)
gradSdf(xc, yc, zc, x, y, z)
sDF(xc, yc, zc, x, y, z)
hess_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id)
grad_sdf(delta_t, t, x, y, z, tx, ty, tz, block_id)
Definition sdf.py:1