pyvista.KochanekSpline

Contents

pyvista.KochanekSpline#

KochanekSpline(
points: VectorLike[float] | MatrixLike[float],
tension: VectorLike[float] | None = None,
bias: VectorLike[float] | None = None,
continuity: VectorLike[float] | None = None,
n_points: int | None = None,
) PolyData[source]#

Create a Kochanek spline from points.

Parameters:
pointsarray_like[float]

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

tensionsequence[float], default: [0.0, 0.0, 0.0]

Changes the length of the tangent vector.

biassequence[float], default: [0.0, 0.0, 0.0]

Primarily changes the direction of the tangent vector.

continuitysequence[float], default: [0.0, 0.0, 0.0]

Changes the sharpness in change between tangents.

n_pointsint, optional

Number of points on the spline. Defaults to points.shape[0].

Returns:
pyvista.PolyData

Kochanek spline.

Examples

Construct a Kochanek 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))
>>> kochanek_spline = pv.KochanekSpline(points, n_points=6)
>>> kochanek_spline.plot(line_width=4, color='k')
../../../_images/pyvista-KochanekSpline-1_00_00.png

See Create a Kochanek Spline for an additional example.