def contains(self, other):
if isinstance(other, Point):
x = other._x
elif isinstance(other, np.ndarray):
x = other
elif isinstance(other, Polygon):
x = _points_to_array(other.vertices)
return np.all(self.contains(x))
else:
raise TypeError("P must be point or ndarray")
# keep track of whether each point is contained in a face
bools = np.full(x.shape[0], False, dtype=bool)
for f in self.faces:
bools = np.logical_or(bools, f.contains(x))
return bools
评论列表
文章目录