def points_and_normals(self):
"""
Returns the point/normals parametrization for planes,
including clipped zmin and zmax frustums
Note: points need to be in CCW
"""
nv1, fv1 = self._front_back_vertices
nv2 = np.roll(nv1, -1, axis=0)
fv2 = np.roll(fv1, -1, axis=0)
vx = np.vstack([fv1-nv1, nv2[0]-nv1[0], fv1[2]-fv1[1]])
vy = np.vstack([fv2-fv1, nv2[1]-nv2[0], fv1[1]-fv1[0]])
pts = np.vstack([fv1, nv1[0], fv1[1]])
# vx += 1e-12
# vy += 1e-12
vx /= np.linalg.norm(vx, axis=1).reshape(-1,1)
vy /= np.linalg.norm(vy, axis=1).reshape(-1,1)
normals = np.cross(vx, vy)
normals /= np.linalg.norm(normals, axis=1).reshape(-1,1)
return pts, normals
评论列表
文章目录