return mesh


if __name__ == "__main__":
    import pickle
    import pyvista as pv
    from pyvista import examples
    torch.set_default_dtype(torch.float32)
    device = "cpu"
    if torch.cuda.device_count():
        device = "cuda:0"

    beta = pv.ParametricTorus()
    beta = pv.PolyData(beta)

    alpha = examples.download_bunny()
    # rotate the bunny
    alpha.rotate_x(100)
    alpha.rotate_z(140)
    alpha.rotate_y(-20)
    alpha = alpha.smooth(100, relaxation_factor=0.1)
    beta = beta.smooth(100, relaxation_factor=0.1)

    alpha = rescale_data(alpha, 0.95)
    beta = rescale_data(beta, 0.95)
    beta.rotate_y(90)

    width = 200
    n_features = width**3

    hist_grid = torch.linspace(-1., 1., width + 1)
Пример #2
0
"""
Bunny
-----

Repair the holes in the bunny mesh
"""

# sphinx_gallery_thumbnail_number = 2
import pyvista as pv
import pymeshfix as mf
from pyvista import examples

################################################################################
bunny = examples.download_bunny()

# Define a camera position that shows the holes in the mesh
cpos = [(-0.2, -0.13, 0.12), (-0.015, 0.10, -0.0), (0.28, 0.26, 0.9)]

# Show mesh
bunny.plot(cpos=cpos)

################################################################################
# Genereate a meshfix mesh ready for fixing and extract the holes
meshfix = mf.MeshFix(bunny)
holes = meshfix.extract_holes()

################################################################################
# Render the mesh and outline the holes
p = pv.Plotter()
p.add_mesh(bunny, color=True)
p.add_mesh(holes, color='r', line_width=8)
Пример #3
0
 def test_download_bunny():
     data = examples.download_bunny()
     assert data.n_points
Пример #4
0
 def __init__(self):
     self._example_data = examples.download_bunny()
     _ExampleLoader.__init__(self)