Spline

Spline(points, n_points=None)

Create a spline from points.

Parameters
pointsnp.ndarray

Array of points to build a spline out of. Array must be 3D and directionally ordered.

n_pointsint, optional

Number of points to interpolate along the points array.

Returns
pyvista.PolyData

Line mesh of spline.

Examples

Construct a spline

>>> import numpy as np
>>> import pyvista as pv
>>> theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
>>> z = np.linspace(-2, 2, 100)
>>> r = z**2 + 1
>>> x = r * np.sin(theta)
>>> y = r * np.cos(theta)
>>> points = np.column_stack((x, y, z))
>>> spline = pv.Spline(points, 1000)
>>> spline.plot(render_lines_as_tubes=True, line_width=10, show_scalar_bar=False)
../../../_images/pyvista-Spline-1_00_00.png