def run_hpr(grid, viewpoint, gamma, boundary):
"""Runs the HPR operator for a single viewpoint and its neighborhood
Runs the HPR operator for a single viewpoint and its neighborhood.
Args:
grid: The support grid containing the data
viewpoint: The viewpoint to be used by the HPR operator.
gamma: The exponent used to flip the points.
boundary: An array of flags used as output.
"""
candidates = grid.get_candidates(viewpoint)
if (candidates.shape[0] == 0):
return
if (candidates.shape[0] <= grid.dimension):
boundary[candidates] = True
return
flipped = exponential_flip(grid.points[candidates], viewpoint, gamma)
# add the viewpoint to the end of the list
flipped = np.vstack([flipped, np.zeros([1, grid.dimension])])
hull = ConvexHull(flipped)
visible_idx = hull.vertices
# remove the index corresponding to the viewpoint
visible_idx.sort()
visible_idx = np.delete(visible_idx, -1)
visible_idx = candidates[visible_idx]
boundary[visible_idx] = True
评论列表
文章目录