InterpolatePy 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. interpolatepy-1.0.0/.editorconfig +17 -0
  2. interpolatepy-1.0.0/.gitattributes +6 -0
  3. interpolatepy-1.0.0/.github/workflows/pre-commit.yml +17 -0
  4. interpolatepy-1.0.0/.github/workflows/test.yml +60 -0
  5. interpolatepy-1.0.0/.gitignore +140 -0
  6. interpolatepy-1.0.0/.pre-commit-config.yaml +34 -0
  7. interpolatepy-1.0.0/InterpolatePy.egg-info/PKG-INFO +415 -0
  8. interpolatepy-1.0.0/InterpolatePy.egg-info/SOURCES.txt +55 -0
  9. interpolatepy-1.0.0/InterpolatePy.egg-info/dependency_links.txt +1 -0
  10. interpolatepy-1.0.0/InterpolatePy.egg-info/requires.txt +25 -0
  11. interpolatepy-1.0.0/InterpolatePy.egg-info/top_level.txt +1 -0
  12. interpolatepy-1.0.0/LICENSE +21 -0
  13. interpolatepy-1.0.0/PKG-INFO +415 -0
  14. interpolatepy-1.0.0/README.md +348 -0
  15. interpolatepy-1.0.0/codecov.yml +8 -0
  16. interpolatepy-1.0.0/examples/b_spline_approx_ex.py +505 -0
  17. interpolatepy-1.0.0/examples/b_spline_cubic_ex.py +77 -0
  18. interpolatepy-1.0.0/examples/b_spline_ex.py +284 -0
  19. interpolatepy-1.0.0/examples/b_spline_interpolate_ex.py +309 -0
  20. interpolatepy-1.0.0/examples/b_spline_smooth_ex.py +116 -0
  21. interpolatepy-1.0.0/examples/c_s_smoot_search_ex.py +96 -0
  22. interpolatepy-1.0.0/examples/c_s_smoothing_ex.py +85 -0
  23. interpolatepy-1.0.0/examples/c_s_with_acc1_ex.py +423 -0
  24. interpolatepy-1.0.0/examples/c_s_with_acc2_ex.py +45 -0
  25. interpolatepy-1.0.0/examples/cubic_spline_ex.py +14 -0
  26. interpolatepy-1.0.0/examples/double_s_ex.py +436 -0
  27. interpolatepy-1.0.0/examples/frenet_frame_ex.py +162 -0
  28. interpolatepy-1.0.0/examples/linear_ex.py +149 -0
  29. interpolatepy-1.0.0/examples/main.py +9 -0
  30. interpolatepy-1.0.0/examples/polynomials_ex.py +596 -0
  31. interpolatepy-1.0.0/examples/simple_paths_ex.py +274 -0
  32. interpolatepy-1.0.0/examples/trapezoidal_ex.py +304 -0
  33. interpolatepy-1.0.0/interpolatepy/__init__.py +8 -0
  34. interpolatepy-1.0.0/interpolatepy/b_spline.py +737 -0
  35. interpolatepy-1.0.0/interpolatepy/b_spline_approx.py +544 -0
  36. interpolatepy-1.0.0/interpolatepy/b_spline_cubic.py +444 -0
  37. interpolatepy-1.0.0/interpolatepy/b_spline_interpolate.py +515 -0
  38. interpolatepy-1.0.0/interpolatepy/b_spline_smooth.py +639 -0
  39. interpolatepy-1.0.0/interpolatepy/c_s_smoot_search.py +177 -0
  40. interpolatepy-1.0.0/interpolatepy/c_s_smoothing.py +611 -0
  41. interpolatepy-1.0.0/interpolatepy/c_s_with_acc1.py +643 -0
  42. interpolatepy-1.0.0/interpolatepy/c_s_with_acc2.py +494 -0
  43. interpolatepy-1.0.0/interpolatepy/cubic_spline.py +486 -0
  44. interpolatepy-1.0.0/interpolatepy/double_s.py +580 -0
  45. interpolatepy-1.0.0/interpolatepy/frenet_frame.py +245 -0
  46. interpolatepy-1.0.0/interpolatepy/linear.py +107 -0
  47. interpolatepy-1.0.0/interpolatepy/polynomials.py +451 -0
  48. interpolatepy-1.0.0/interpolatepy/simple_paths.py +281 -0
  49. interpolatepy-1.0.0/interpolatepy/trapezoidal.py +613 -0
  50. interpolatepy-1.0.0/interpolatepy/tridiagonal_inv.py +96 -0
  51. interpolatepy-1.0.0/interpolatepy/version.py +5 -0
  52. interpolatepy-1.0.0/pyproject.toml +326 -0
  53. interpolatepy-1.0.0/requirements-dev.txt +21 -0
  54. interpolatepy-1.0.0/requirements.txt +4 -0
  55. interpolatepy-1.0.0/setup.cfg +4 -0
  56. interpolatepy-1.0.0/tests/__init__.py +0 -0
  57. interpolatepy-1.0.0/tests/inv_test.py +375 -0
@@ -0,0 +1,17 @@
1
+ # EditorConfig is awesome: http://EditorConfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ indent_style = space
7
+ indent_size = 4
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+ end_of_line = lf
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
14
+
15
+ [Makefile]
16
+ indent_style = tab
17
+ trim_trailing_whitespace = false
@@ -0,0 +1,6 @@
1
+ # Set the default behavior for all files.
2
+ * text=auto eol=lf
3
+
4
+ # Normalized and converts to native line endings on checkout.
5
+ *.py text
6
+ *.pyx text
@@ -0,0 +1,17 @@
1
+ name: pre-commit
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [ main, master ]
7
+
8
+ jobs:
9
+ pre-commit:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: Set up Python
14
+ uses: actions/setup-python@v5
15
+ with:
16
+ python-version: '3.12'
17
+ - uses: pre-commit/action@v3.0.1
@@ -0,0 +1,60 @@
1
+ name: ci-test
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, master ]
6
+ pull_request:
7
+ branches: [ main, master ]
8
+
9
+ jobs:
10
+ build-windows:
11
+ runs-on: windows-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Set up Python 3.12
15
+ uses: actions/setup-python@v5
16
+ with:
17
+ python-version: 3.12
18
+ - name: Install dependencies
19
+ run: |
20
+ python -m pip install --upgrade pip
21
+ pip install -r requirements-dev.txt
22
+ pip install -e .
23
+ - name: Testing
24
+ run: |
25
+ python -m pytest tests
26
+
27
+ build-linux:
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - name: Set up Python 3.12
32
+ uses: actions/setup-python@v3
33
+ with:
34
+ python-version: 3.12
35
+ - name: Install dependencies
36
+ run: |
37
+ python -m pip install --upgrade pip
38
+ pip install -r requirements-dev.txt
39
+ pip install -e .
40
+ - name: Testing
41
+ run: |
42
+ python -m pytest --cov=ik_ur tests
43
+ python -m codecov
44
+
45
+ build-macos:
46
+ runs-on: macos-latest
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+ - name: Set up Python 3.12
50
+ uses: actions/setup-python@v5
51
+ with:
52
+ python-version: 3.12
53
+ - name: Install dependencies
54
+ run: |
55
+ python -m pip install --upgrade pip
56
+ pip install -r requirements-dev.txt
57
+ pip install -e .
58
+ - name: Testing
59
+ run: |
60
+ python -m pytest tests
@@ -0,0 +1,140 @@
1
+ ################################
2
+ ########### FILES ############
3
+ ################################
4
+ *.exe
5
+
6
+ ################################
7
+ ########### FOLDERS ############
8
+ ################################
9
+ build/
10
+ html/
11
+ .benchmarks/
12
+ reports/
13
+ lectures/
14
+ logs/
15
+ models/
16
+ ressources/
17
+ .ruff_cache
18
+ data/*.h5
19
+ venv/
20
+ .venv/
21
+ .conda/
22
+
23
+ ################################
24
+ ########### PYTHON #############
25
+ ################################
26
+
27
+ # Byte-compiled / optimized / DLL files
28
+ __pycache__/
29
+ *.py[cod]
30
+ *$py.class
31
+
32
+ # C extensions
33
+ *.so
34
+
35
+ # Distribution / packaging
36
+ .Python
37
+ build/
38
+ develop-eggs/
39
+ dist/
40
+ downloads/
41
+ eggs/
42
+ .eggs/
43
+ lib/
44
+ lib64/
45
+ parts/
46
+ sdist/
47
+ var/
48
+ wheels/
49
+ *.egg-info/
50
+ .installed.cfg
51
+ *.egg
52
+ MANIFEST
53
+
54
+ # PyInstaller
55
+ # Usually these files are written by a python script from a template
56
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
57
+ *.manifest
58
+ *.spec
59
+
60
+ # Installer logs
61
+ pip-log.txt
62
+ pip-delete-this-directory.txt
63
+
64
+ # Unit test / coverage reports
65
+ htmlcov/
66
+ .tox/
67
+ .coverage
68
+ .coverage.*
69
+ .cache
70
+ nosetests.xml
71
+ coverage.xml
72
+ *.cover
73
+ .hypothesis/
74
+ .pytest_cache/
75
+
76
+ # Translations
77
+ *.mo
78
+ *.pot
79
+
80
+ # Django stuff:
81
+ *.log
82
+ local_settings.py
83
+ db.sqlite3
84
+
85
+ # Flask stuff:
86
+ instance/
87
+ .webassets-cache
88
+
89
+ # Scrapy stuff:
90
+ .scrapy
91
+
92
+ # Sphinx documentation
93
+ docs/build/
94
+
95
+ # PyBuilder
96
+ target/
97
+
98
+ # Jupyter Notebook
99
+ .ipynb_checkpoints
100
+
101
+ # pyenv
102
+ .python-version
103
+
104
+ # celery beat schedule file
105
+ celerybeat-schedule
106
+
107
+ # SageMath parsed files
108
+ *.sage.py
109
+
110
+ # Environments
111
+ .env
112
+ .venv
113
+ env/
114
+ venv/
115
+ ENV/
116
+ env.bak/
117
+ venv.bak/
118
+
119
+ # Spyder project settings
120
+ .spyderproject
121
+ .spyproject
122
+
123
+ # Rope project settings
124
+ .ropeproject
125
+
126
+ # mkdocs documentation
127
+ /site
128
+
129
+ # mypy
130
+ .mypy_cache/
131
+ .mypy_cache*
132
+
133
+ *.isorted
134
+
135
+ ################################
136
+ ########### VS CODE ############
137
+ ################################
138
+ .vscode
139
+ *.code-workspace
140
+ .history
@@ -0,0 +1,34 @@
1
+ default_language_version:
2
+ python: python3
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v5.0.0
6
+ hooks:
7
+ - id: check-ast
8
+ - id: check-builtin-literals
9
+ - id: check-merge-conflict
10
+ - id: check-yaml
11
+ - id: check-toml
12
+
13
+ - repo: https://github.com/PyCQA/isort
14
+ rev: 6.0.1
15
+ hooks:
16
+ - id: isort
17
+
18
+ - repo: https://github.com/psf/black
19
+ rev: 25.1.0
20
+ hooks:
21
+ - id: black
22
+
23
+ - repo: https://github.com/astral-sh/ruff-pre-commit
24
+ rev: 'v0.11.0'
25
+ hooks:
26
+ - id: ruff
27
+ types_or: [python, pyi, jupyter]
28
+ args: [ --fix, --exit-non-zero-on-fix, --preview ]
29
+
30
+ - repo: https://github.com/pre-commit/mirrors-mypy
31
+ rev: v1.15.0
32
+ hooks:
33
+ - id: mypy
34
+ args: [--ignore-missing-imports]
@@ -0,0 +1,415 @@
1
+ Metadata-Version: 2.4
2
+ Name: InterpolatePy
3
+ Version: 1.0.0
4
+ Summary: This is a lib on interpolations in python.
5
+ Author-email: Giorgio Medico <giorgio.medico11@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 GiorgioMedico
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Platform: unix
29
+ Platform: linux
30
+ Platform: osx
31
+ Platform: cygwin
32
+ Platform: win32
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.10
35
+ Classifier: Programming Language :: Python :: 3.11
36
+ Classifier: Programming Language :: Python :: 3.12
37
+ Classifier: Operating System :: Microsoft :: Windows
38
+ Classifier: Operating System :: POSIX :: Linux
39
+ Classifier: Operating System :: POSIX
40
+ Classifier: Operating System :: Unix
41
+ Classifier: Operating System :: MacOS
42
+ Requires-Python: >=3.10
43
+ Description-Content-Type: text/markdown
44
+ License-File: LICENSE
45
+ Requires-Dist: numpy>=2.0.0
46
+ Requires-Dist: matplotlib>=3.10.1
47
+ Provides-Extra: test
48
+ Requires-Dist: pytest; extra == "test"
49
+ Requires-Dist: pytest-cov; extra == "test"
50
+ Requires-Dist: codecov; extra == "test"
51
+ Requires-Dist: pre-commit; extra == "test"
52
+ Provides-Extra: doc
53
+ Requires-Dist: mkdocs; extra == "doc"
54
+ Requires-Dist: mkdocstrings; extra == "doc"
55
+ Requires-Dist: mkdocstrings[python]; extra == "doc"
56
+ Requires-Dist: mkdocs-material; extra == "doc"
57
+ Requires-Dist: Pygments; extra == "doc"
58
+ Provides-Extra: dev
59
+ Requires-Dist: black; extra == "dev"
60
+ Requires-Dist: isort; extra == "dev"
61
+ Requires-Dist: mypy; extra == "dev"
62
+ Requires-Dist: pre-commit; extra == "dev"
63
+ Requires-Dist: ruff; extra == "dev"
64
+ Provides-Extra: all
65
+ Requires-Dist: interpolatepy[dev,doc,test]; extra == "all"
66
+ Dynamic: license-file
67
+
68
+ # InterpolatePy
69
+
70
+ ![Python](https://img.shields.io/badge/python-3.10+-blue)
71
+ [![pre-commit](https://github.com/GiorgioMedico/InterpolatePy/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/GiorgioMedico/InterpolatePy/actions/workflows/pre-commit.yml)
72
+ [![ci-test](https://github.com/GiorgioMedico/InterpolatePy/actions/workflows/test.yml/badge.svg)](https://github.com/GiorgioMedico/InterpolatePy/actions/workflows/test.yml)
73
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
74
+
75
+ ## Table of Contents
76
+ - [Overview](#overview)
77
+ - [Key Features](#key-features)
78
+ - [Spline Interpolation](#spline-interpolation)
79
+ - [Motion Profiles](#motion-profiles)
80
+ - [Path Generation](#path-generation)
81
+ - [Utility Functions](#utility-functions)
82
+ - [Installation](#installation)
83
+ - [Usage Examples](#usage-examples)
84
+ - [Mathematical Concepts](#mathematical-concepts)
85
+ - [Requirements](#requirements)
86
+ - [Development](#development)
87
+ - [Contributing](#contributing)
88
+ - [License](#license)
89
+ - [Acknowledgments](#acknowledgments)
90
+
91
+ ## Overview
92
+
93
+ InterpolatePy is a comprehensive Python library for generating smooth trajectories and curves with precise control over position, velocity, acceleration, and jerk profiles. Designed for robotics, motion planning, computer graphics, and scientific computing applications, it provides a wide range of interpolation techniques from simple linear interpolation to advanced B-splines and motion profiles.
94
+
95
+ Whether you need to generate smooth robotic joint motions, create path planning for autonomous vehicles, or design animation curves with specific dynamic properties, InterpolatePy offers the tools to create trajectories that maintain continuity while adhering to physical constraints.
96
+
97
+ ## Key Features
98
+
99
+ ### Spline Interpolation
100
+
101
+ #### B-Splines
102
+
103
+ - **BSpline**: Versatile implementation with customizable degree and knot vectors
104
+ - **ApproximationBSpline**: Efficiently approximates sets of points with a B-spline curve
105
+ - **CubicBSplineInterpolation**: Specialized cubic B-spline interpolation that passes through all points
106
+ - **BSplineInterpolator**: General B-spline interpolation with controllable continuity (C²-C⁴)
107
+ - **SmoothingCubicBSpline**: B-splines with adjustable smoothness-vs-accuracy tradeoff
108
+
109
+ #### Cubic Splines
110
+
111
+ - **CubicSpline**: Standard cubic spline with velocity constraints at endpoints
112
+ - **CubicSplineWithAcceleration1**: Cubic spline with velocity and acceleration constraints (extra points method)
113
+ - **CubicSplineWithAcceleration2**: Alternative cubic spline with acceleration constraints (quintic segments method)
114
+ - **CubicSmoothingSpline**: Cubic splines with μ parameter for smoothness control
115
+ - **SplineConfig/smoothing_spline_with_tolerance**: Tools for finding optimal smoothing parameters
116
+
117
+ ##### Imposing Acceleration Constraints at Endpoints
118
+
119
+ InterpolatePy offers two distinct methods for implementing cubic splines with endpoint acceleration constraints:
120
+
121
+ 1. **Extra Points Method (`CubicSplineWithAcceleration1`)**: This approach adds two extra points in the first and last segments to satisfy the acceleration constraints while maintaining C² continuity throughout the entire curve. The extra points are placed at the midpoints of the first and last segments, with positions calculated to ensure the specified accelerations at endpoints are achieved.
122
+
123
+ 2. **Quintic Segments Method (`CubicSplineWithAcceleration2`)**: This approach uses standard cubic polynomials for interior segments, but replaces the first and last segments with quintic (5th degree) polynomials. The higher degree provides the additional degrees of freedom needed to satisfy the acceleration constraints at endpoints while maintaining overall C² continuity at all knot points.
124
+
125
+ ### Motion Profiles
126
+
127
+ - **DoubleSTrajectory**: S-curve motion profile with bounded velocity, acceleration, and jerk
128
+ - **linear_traj**: Simple linear interpolation with constant velocity
129
+ - **PolynomialTrajectory**: Trajectory generation using polynomials of orders 3, 5, and 7
130
+ - **TrapezoidalTrajectory**: Trapezoidal velocity profiles with various constraint options
131
+
132
+ ### Path Generation
133
+
134
+ - **LinearPath**: Simple linear paths with constant velocity
135
+ - **CircularPath**: Circular arcs and paths in 3D
136
+ - **Frenet Frames**: Tools for computing and visualizing Frenet frames along parametric curves
137
+
138
+ ### Utility Functions
139
+
140
+ - **solve_tridiagonal**: Efficient tridiagonal matrix solver (Thomas algorithm)
141
+
142
+ ## Installation
143
+
144
+ ### From Source
145
+
146
+ To install the latest development version with all dependencies:
147
+
148
+ ```bash
149
+ # Clone the repository
150
+ git clone https://github.com/GiorgioMedico/InterpolatePy.git
151
+ cd InterpolatePy
152
+
153
+ # Install with development dependencies
154
+ pip install -e ".[all]"
155
+ ```
156
+
157
+ ### Optional Dependencies
158
+
159
+ You can install specific dependency groups:
160
+
161
+ ```bash
162
+ # For testing dependencies only
163
+ pip install -e ".[test]"
164
+
165
+ # For documentation dependencies only
166
+ pip install -e ".[doc]"
167
+
168
+ # For development tools only
169
+ pip install -e ".[dev]"
170
+ ```
171
+
172
+ ## Usage Examples
173
+
174
+ ### Cubic Spline Trajectory
175
+
176
+ Create a smooth trajectory through waypoints with velocity constraints:
177
+
178
+ ```python
179
+ from interpolatepy.cubic_spline import CubicSpline
180
+
181
+ # Define waypoints
182
+ t_points = [0.0, 5.0, 7.0, 8.0, 10.0, 15.0, 18.0]
183
+ q_points = [3.0, -2.0, -5.0, 0.0, 6.0, 12.0, 8.0]
184
+
185
+ # Create cubic spline with initial and final velocities
186
+ spline = CubicSpline(t_points, q_points, v0=2.0, vn=-3.0)
187
+
188
+ # Evaluate at specific time
189
+ position = spline.evaluate(6.0)
190
+ velocity = spline.evaluate_velocity(6.0)
191
+ acceleration = spline.evaluate_acceleration(6.0)
192
+
193
+ # Plot the trajectory with position, velocity, and acceleration profiles
194
+ spline.plot()
195
+ ```
196
+
197
+ ### Cubic Spline with Acceleration Constraints
198
+
199
+ Create a smooth trajectory with both velocity and acceleration constraints at endpoints:
200
+
201
+ ```python
202
+ from interpolatepy.c_s_with_acc2 import CubicSplineWithAcceleration2, SplineParameters
203
+
204
+ # Define waypoints
205
+ t_points = [0.0, 5.0, 7.0, 8.0, 10.0, 15.0, 18.0]
206
+ q_points = [3.0, -2.0, -5.0, 0.0, 6.0, 12.0, 8.0]
207
+
208
+ # Create parameters with velocity and acceleration constraints
209
+ params = SplineParameters(
210
+ v0=2.0, # Initial velocity
211
+ vn=-3.0, # Final velocity
212
+ a0=0.0, # Initial acceleration
213
+ an=0.0 # Final acceleration
214
+ )
215
+
216
+ # Create spline with quintic segments at endpoints
217
+ spline = CubicSplineWithAcceleration2(t_points, q_points, params)
218
+
219
+ # Evaluate at specific time
220
+ position = spline.evaluate(6.0)
221
+ velocity = spline.evaluate_velocity(6.0)
222
+ acceleration = spline.evaluate_acceleration(6.0)
223
+
224
+ # Plot the trajectory
225
+ spline.plot()
226
+ ```
227
+
228
+ ### Double-S Trajectory
229
+
230
+ Generate a trajectory with bounded jerk for smooth motion profiles:
231
+
232
+ ```python
233
+ from interpolatepy.double_s import DoubleSTrajectory, StateParams, TrajectoryBounds
234
+
235
+ # Create parameters for trajectory
236
+ state = StateParams(q_0=0.0, q_1=10.0, v_0=0.0, v_1=0.0)
237
+ bounds = TrajectoryBounds(v_bound=5.0, a_bound=10.0, j_bound=30.0)
238
+
239
+ # Create trajectory
240
+ trajectory = DoubleSTrajectory(state, bounds)
241
+
242
+ # Get trajectory information
243
+ duration = trajectory.get_duration()
244
+ phases = trajectory.get_phase_durations()
245
+
246
+ # Generate trajectory points
247
+ import numpy as np
248
+ time_points = np.linspace(0, duration, 100)
249
+ positions, velocities, accelerations, jerks = trajectory.evaluate(time_points)
250
+ ```
251
+
252
+ ### B-Spline Curve
253
+
254
+ Create and manipulate a B-spline curve with control points:
255
+
256
+ ```python
257
+ import numpy as np
258
+ from interpolatepy.b_spline import BSpline
259
+
260
+ # Define control points, degree, and knot vector
261
+ control_points = np.array([[0, 0], [1, 2], [3, 1], [4, 0]])
262
+ degree = 3
263
+ knots = BSpline.create_uniform_knots(degree, len(control_points))
264
+
265
+ # Create B-spline
266
+ bspline = BSpline(degree, knots, control_points)
267
+
268
+ # Evaluate at parameter value
269
+ point = bspline.evaluate(0.5)
270
+
271
+ # Generate curve points for plotting
272
+ u_values, curve_points = bspline.generate_curve_points(100)
273
+
274
+ # Plot the curve with control polygon
275
+ bspline.plot_2d(show_control_polygon=True)
276
+ ```
277
+
278
+ ### Trapezoidal Trajectory with Waypoints
279
+
280
+ Generate a trajectory with trapezoidal velocity profile through multiple points:
281
+
282
+ ```python
283
+ from interpolatepy.trapezoidal import TrapezoidalTrajectory, InterpolationParams
284
+
285
+ # Define waypoints
286
+ points = [0.0, 5.0, 3.0, 8.0, 2.0]
287
+
288
+ # Create interpolation parameters
289
+ params = InterpolationParams(
290
+ points=points,
291
+ v0=0.0, # Initial velocity
292
+ vn=0.0, # Final velocity
293
+ amax=10.0, # Maximum acceleration
294
+ vmax=5.0 # Maximum velocity
295
+ )
296
+
297
+ # Generate trajectory
298
+ traj_func, duration = TrapezoidalTrajectory.interpolate_waypoints(params)
299
+
300
+ # Evaluate at specific time
301
+ position, velocity, acceleration = traj_func(2.5)
302
+ ```
303
+
304
+ ### 3D Path with Frenet Frames
305
+
306
+ Create and visualize a trajectory with coordinate frames along the path:
307
+
308
+ ```python
309
+ import numpy as np
310
+ import matplotlib.pyplot as plt
311
+ from interpolatepy.frenet_frame import (
312
+ helicoidal_trajectory_with_derivatives,
313
+ compute_trajectory_frames,
314
+ plot_frames
315
+ )
316
+
317
+ # Create a helicoidal path
318
+ u_values = np.linspace(0, 4 * np.pi, 100)
319
+ def helix_func(u):
320
+ return helicoidal_trajectory_with_derivatives(u, r=2.0, d=0.5)
321
+
322
+ # Compute Frenet frames along the path
323
+ points, frames = compute_trajectory_frames(helix_func, u_values)
324
+
325
+ # Visualize
326
+ fig = plt.figure(figsize=(10, 8))
327
+ ax = fig.add_subplot(111, projection='3d')
328
+ plot_frames(ax, points, frames, scale=0.5, skip=10)
329
+ plt.show()
330
+ ```
331
+
332
+ ## Mathematical Concepts
333
+
334
+ InterpolatePy implements several key mathematical concepts for trajectory generation:
335
+
336
+ ### B-splines
337
+ Piecewise parametric curves defined by control points and a knot vector. B-splines offer local control (changes to a control point only affect the curve locally) and customizable continuity.
338
+
339
+ ### Cubic Splines
340
+ Piecewise polynomials with C² continuity (continuous position, velocity, and acceleration) that interpolate a given set of points.
341
+
342
+ ### Smoothing Splines
343
+ Splines with a controllable balance between accuracy (passing through points exactly) and smoothness (minimizing curvature). The μ parameter controls this tradeoff.
344
+
345
+ ### Trapezoidal Velocity Profiles
346
+ Trajectories with linear segments of constant acceleration and velocity, creating a trapezoidal shape in the velocity profile.
347
+
348
+ ### Double-S Trajectories
349
+ Motion profiles with bounded jerk, acceleration, and velocity, creating smooth S-curves in the acceleration profile. These are ideal for robotic motion to reduce stress on mechanical systems.
350
+
351
+ ### Frenet Frames
352
+ Local coordinate systems defined by tangent, normal, and binormal vectors along a curve, useful for tool orientation and trajectory tracking.
353
+
354
+ ## Requirements
355
+
356
+ - Python 3.10+
357
+ - NumPy 2.0.0+
358
+ - Matplotlib 3.10.1+
359
+ - SciPy 1.15.2+
360
+
361
+ ## Development
362
+
363
+ InterpolatePy uses modern Python tooling for development:
364
+
365
+ - **Code Quality**: Black and isort for formatting, Ruff and mypy for linting and type checking
366
+ - **Testing**: pytest for unit tests and benchmarks
367
+ - **Documentation**: mkdocs for documentation generation
368
+
369
+ To set up the development environment:
370
+
371
+ ```bash
372
+ pip install -e ".[all]"
373
+ pre-commit install
374
+ ```
375
+
376
+ ### Running Tests
377
+
378
+ ```bash
379
+ python -m pytest tests
380
+ ```
381
+
382
+ ### Building Documentation
383
+
384
+ ```bash
385
+ mkdocs build
386
+ # or to serve locally
387
+ mkdocs serve
388
+ ```
389
+
390
+ ## Contributing
391
+
392
+ Contributions to InterpolatePy are welcome! To contribute:
393
+
394
+ 1. Fork the repository
395
+ 2. Create a feature branch
396
+ 3. Add your changes
397
+ 4. Run tests to ensure they pass
398
+ 5. Submit a pull request
399
+
400
+ Please follow the existing code style and include appropriate tests for new features.
401
+
402
+ ## License
403
+
404
+ InterpolatePy is released under the MIT License. See the [LICENSE](https://github.com/GiorgioMedico/InterpolatePy/blob/main/LICENSE) file for more details.
405
+
406
+ ## Acknowledgments
407
+
408
+ InterpolatePy implements algorithms and mathematical concepts primarily from the following authoritative textbooks:
409
+
410
+ - Biagiotti, L., & Melchiorri, C. (2008). *Trajectory Planning for Automatic Machines and Robots*. Springer.
411
+ - Siciliano, B., Sciavicco, L., Villani, L., & Oriolo, G. (2010). *Robotics: Modelling, Planning and Control*. Springer.
412
+
413
+ The library's implementation draws heavily from the theoretical frameworks, mathematical formulations, and algorithms presented in these works.
414
+
415
+ I express my gratitude to these authors for their significant contributions to the field of trajectory planning and robotics, which have made this library possible.