splinebox.spline_curves.Spline.

scale#

Spline.scale(scaling_factor)#

Enlarge or shrink the spline by the provided factor.

Parameters:
scaling_factorfloat

The factor by which the spline should be scaled.

Examples

>>> import splinebox
>>> import numpy as np
>>> import matplotlib.pyplot as plt

We start by creating a spline

>>> spline = splinebox.Spline(M=4, basis_function=splinebox.B3(), closed=True)
>>> spline.control_points = np.array([[3, 0], [1, 1], [-1, 0], [-1, -1]])

Let’s plot the spline:

>>> t = np.linspace(0, spline.M, 1000)
>>> vals = spline(t)
>>> plt.plot(vals[:, 0], vals[:, 1], label="orig")

Next, we scale the spline and plot it again:

>>> spline.scale(0.5)
>>> vals = spline(t)
>>> plt.plot(vals[:, 0], vals[:, 1], linestyle="--", label="scaled")
>>> plt.legend()
>>> plt.show()
../../_images/splinebox-spline_curves-Spline-scale-1.png