# Examples from pyvista.wrap
# ==========================

# Wrap a numpy array representing a random point cloud.
import numpy as np
import pyvista as pv
points = np.random.default_rng().random((10, 3))
cloud = pv.wrap(points)
cloud

# Wrap a VTK object.
import pyvista as pv
import vtk
points = vtk.vtkPoints()
p = [1.0, 2.0, 3.0]
vertices = vtk.vtkCellArray()
pid = points.InsertNextPoint(p)
_ = vertices.InsertNextCell(1)
_ = vertices.InsertCellPoint(pid)
point = vtk.vtkPolyData()
_ = point.SetPoints(points)
_ = point.SetVerts(vertices)
mesh = pv.wrap(point)
mesh

# Wrap a Trimesh object.
import trimesh
import pyvista as pv
points = [[0, 0, 0], [0, 0, 1], [0, 1, 0]]
faces = [[0, 1, 2]]
tmesh = trimesh.Trimesh(points, faces=faces, process=False)
mesh = pv.wrap(tmesh)
mesh

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code

