def points_in_front(self, points, inverted=False, ret_indices=False):
'''
Given an array of points, return the points which lie either on the
plane or in the half-space in front of it (i.e. in the direction of
the plane normal).
points: An array of points.
inverted: When `True`, invert the logic. Return the points that lie
behind the plane instead.
ret_indices: When `True`, return the indices instead of the points
themselves.
'''
sign = self.sign(points)
if inverted:
mask = np.less_equal(sign, 0)
else:
mask = np.greater_equal(sign, 0)
indices = np.flatnonzero(mask)
return indices if ret_indices else points[indices]
评论列表
文章目录