def half_space(self):
"""Return the half space polytope respresentation of the infinite
beam."""
# add half beam width along the normal direction to each of the points
half = self.normal * self.size / 2
edges = [Line(self.p1 + half, self.p2 + half),
Line(self.p1 - half, self.p2 - half)]
A = np.ndarray((len(edges), self.dim))
B = np.ndarray(len(edges))
for i in range(0, 2):
A[i, :], B[i] = edges[i].standard
# test for positive or negative side of line
if np.einsum('i, i', self.p1._x, A[i, :]) > B[i]:
A[i, :] = -A[i, :]
B[i] = -B[i]
p = pt.Polytope(A, B)
return p
评论列表
文章目录