splinebox.spline_curves.HermiteSpline.
to_json#
- HermiteSpline.to_json(path, version=1)#
Saves the spline as a json file.
- Parameters:
- pathstr or pathlib.Path
The path where the json file should be saved.
- versionint
The version of the json file. Default is latest version.
Examples
>>> spline = splinebox.Spline(M=3, basis_function=splinebox.B1(), closed=True) >>> spline.knots = np.array([[0.8, 1.2], [0.7, 1.5], [1.1, 0.3]])
Save the spline to file…
>>> path = path_to_some_directory / "spline.json" >>> spline.to_json(path)
Let’s take a look at the file…
>>> print(open(path, "r").read()) { "version": 1, "M": 3, "basis_function": "B1", "closed": true, "control_points": [ [ 0.8, 1.2 ], [ 0.7, 1.5 ], [ 1.1, 0.3 ] ] }