Ejemplo n.º 1
0
 def check_all_normals(self, interval=100) -> None:
     centroid = math.mean(self)
     scale = np.mean(self.nn_weights[:, 3])
     normals = self.point_normals[:, ::interval]*scale
     pyplot.plot3d(*self[:, ::interval], '.', alpha=1, markersize=1)
     pyplot.quiver3d(
         *self[:, ::interval],
         *normals)
     pyplot.equal_aspect_3d_centered(centroid)
     pyplot.show()
Ejemplo n.º 2
0
    def check_normals_n_at_a_time(self, interval=1000, n_normals=3) -> None:
        scale = np.mean(self.nn_weights[:, 3])

        for i, (point, normal) in enumerate(
                zip(self.T, self.point_normals.T)):
            if i % interval == 0:
                normal = normal*scale
                I_nearest = self.nn_indices[i]
                # nn = self[:, I_nearest]
                # nn_normals = self.point_normals[I_nearest]
                pyplot.plot3d(*self, '.', alpha=1, markersize=1)
                pyplot.quiver3d(*point, *normal)
                pyplot.equal_aspect_3d_centered(point)
                pyplot.show()
Ejemplo n.º 3
0
 def plot3d(self, *args, **kwargs):
     """
     """
     return pyplot.plot3d(*self, *args, **kwargs)
Ejemplo n.º 4
0
 def plot_surface(self, *args, **kwargs):
     if len(args) == 0:
         args = ('.', )
     pyplot.plot3d(*self, *args, **kwargs)
Ejemplo n.º 5
0
    file = data_folder/'00000.vtk'
    pv_obj = pv.read(file)

    points = pv_obj.points.T
    test_points = points[:, ::20]*1000
    # test_points = points*1000
    psurf = Pointsurface(
        test_points, leafsize=100, neighbours=13, external=True)
    psurf.compute_all_normals()
    psurf.compute_principle_curvatures(n_processors=5)
    psurf
    if False:
        ii = 500
        ids = psurf.nn_indices[ii]
        xx, yy = psurf.principle_directions[ii].T
        X, Y, Z = psurf.point_basis[ii].T
        pyplot.plot3d(*psurf, '.', alpha=0.5, markersize=2)
        pyplot.plot3d(*psurf[:, ii, None], 'go')
        pyplot.plot3d(*psurf[:, ids], 'ro')
        pyplot.quiver3d(*psurf[:, ii, None], *X[:, None], color='blue')
        pyplot.quiver3d(*psurf[:, ii, None], *Y[:, None], color='blue')
        pyplot.quiver3d(*psurf[:, ii, None], *Z[:, None], color='green')
        pyplot.quiver3d(*psurf[:, ii, None], *xx[:, None], color='red')
        pyplot.quiver3d(*psurf[:, ii, None], *yy[:, None], color='red')
        pyplot.equal_aspect_3d_centered(psurf[:, ii, None])
        pyplot.show()
    # psurf.plot_curvature()
    # pyplot.show()
    # psurf.check_all_normals(interval=1)
    print('done')