1
"""Methods to convert point set objects to VTK data objects"""
2

3

4 26
__all__ = [
5
    'point_set_to_vtk',
6
]
7

8 26
__displayname__ = 'Point Set'
9

10 26
import numpy as np
11 26
import pyvista
12

13 26
from omfvista.utilities import add_data, add_textures
14

15

16 26
def point_set_to_vtk(pse, origin=(0.0, 0.0, 0.0)):
17
    """Convert the point set to a :class:`pyvista.PolyData` data object.
18

19
    Args:
20
        pse (:class:`omf.pointset.PointSetElement`): The point set to convert
21

22
    Return:
23
        :class:`pyvista.PolyData`
24
    """
25 26
    points = np.array(pse.geometry.vertices)
26 26
    output = pyvista.PolyData(points)
27

28
    # Now add point data:
29 26
    add_data(output, pse.data)
30

31 26
    add_textures(output, pse.textures, pse.name)
32

33 26
    output.points += np.array(origin)
34 26
    return output
35

36

37 26
point_set_to_vtk.__displayname__ = 'Point Set to VTK'

Read our documentation on viewing source code .

Loading