Untitled
unknown
python
2 years ago
655 B
9
Indexable
alpha=1
def distance(x, p, n):
return np.dot(n,(x-p))
def weight(x, p):
return np.exp(-alpha*np.linalg.norm(x-p)**2)
def updateVolumes(v,p,n):
voxelInSpace = xform.map(v)
w = weight(voxelInSpace,p)
d = distance(voxelInSpace,p,n)
volume[v] += w*d
volume_w[v] += w
voxelPointMap = dict()
for i in range(NO_POINTS):
point = point_mat[i,:]
normal = norm_mat[i,:]
corresponding_voxel = xform.inv_map(point)
neighbours = voxel_neighbourhood(volume_dimensions, corresponding_voxel)
for neighbour in neighbours:
updateVolumes(neighbour,point,normal)
volume /= (volume_w+1e-10)Editor is loading...
Leave a Comment