Points to Tube

This example will demonstrate how to to build a tube from a set of points in vtkPolyData.

Takes points from a vtkPolyData object and constructs a line of those points then builds a polygonal tube around that line with some specified radius and number of sides.

import numpy as np

# sphinx_gallery_thumbnail_number = 2
import pyvista

from PVGeo.filters import PointsToTube
def path(y):
    """Equation: x = a(y-h)^2 + k"""
    a = -110.0 / 160.0**2
    x = a * y**2 + 110.0
    return x, y

x, y = path(np.arange(0.0, 200.0, 25.0))
zo = np.linspace(9.0, 11.0, num=len(y))
points = pyvista.PolyData(np.c_[x, y, zo])

points to tube
# Use the filter: here is vtkPolyData containing the tube
tube = PointsToTube(nearestNbr=True).apply(points)
points to tube

Total running time of the script: ( 0 minutes 0.609 seconds)

Gallery generated by Sphinx-Gallery