def AddColoredPointCloudActor(self, pc): """Add a point cloud with colors from a given NumPy array The NumPy array should have dimension Nx6 where the first three dimensions correspond to X, Y and Z and the last three dimensions correspond to R, G and B values (between 0 and 255) """ obj = VTKObject() obj.CreateFromArray(pc[:, :3]) obj.AddColors(pc[:, 3:6].astype(np.uint8)) self.pointObjects.append(obj) self.renderer.AddActor(obj.GetActor()) return obj
def AddShadedPointsActor(self, pc): """Add a point cloud with shaded points based on supplied normal vectors The NumPy array should have dimension Nx6 where the first three dimensions correspond to x, y and z and the last three dimensions correspond to surface normals (nx, ny, nz) """ obj = VTKObject() obj.CreateFromArray(pc[:, 0:3]) obj.AddNormals(pc[:, 3:6]) self.pointObjects.append(obj) self.renderer.AddActor(obj.GetActor()) return obj
def AddPointCloudActor(self, pc): """Add a point cloud from a given NumPy array The NumPy array should have dimension Nxd where d >= 3 If d>3, the points will be colored according to the last column in the supplied array (values should be between 0 and 1, where 0 is black and 1 is white) """ obj = VTKObject() obj.CreateFromArray(pc) self.pointObjects.append(obj) self.renderer.AddActor(obj.GetActor()) return obj
def AddNormalsActor(self, pc, scale): """Add a set of surface normals to the visualizer The input is a NumPy array with dimension Nx6 with (x,y,z) and (nx,ny,nz) values for the points and associated surface normals The normals will be scaled according to given scale factor""" obj = VTKObject() obj.CreateFromArray(pc[:, 0:3]) obj.AddNormals(pc[:, 3:6]) obj.SetupPipelineHedgeHog(scale) self.pointObjects.append(obj) self.renderer.AddActor(obj.GetActor()) return obj