InterpolatePy
Production-ready trajectory planning and interpolation for robotics, animation, and scientific computing.
InterpolatePy provides 20+ algorithms for smooth trajectory generation with precise control over position, velocity, acceleration, and jerk. From cubic splines and B-curves to quaternion interpolation and S-curve motion profiles — everything you need for professional motion control.
⚡ Fast: Vectorized NumPy operations, ~1ms for 1000-point cubic splines
🎯 Precise: Research-grade algorithms with C² continuity and bounded derivatives
📊 Visual: Built-in plotting for every algorithm
🔧 Complete: Splines, motion profiles, quaternions, and path planning in one library
Installation
pip install InterpolatePy
Requirements: Python ≥3.10, NumPy ≥2.0, SciPy ≥1.15, Matplotlib ≥3.10
Development Installation
git clone https://github.com/GiorgioMedico/InterpolatePy.git
cd InterpolatePy
pip install -e '.[all]' # Includes testing and development tools
Quick Start
import numpy as np
import matplotlib.pyplot as plt
from interpolatepy import CubicSpline, DoubleSTrajectory, StateParams, TrajectoryBounds
# Smooth spline through waypoints
t_points = [0.0, 5.0, 10.0, 15.0]
q_points = [0.0, 2.0, -1.0, 3.0]
spline = CubicSpline(t_points, q_points, v0=0.0, vn=0.0)
# Evaluate at any time
position = spline.evaluate(7.5)
velocity = spline.evaluate_velocity(7.5)
acceleration = spline.evaluate_acceleration(7.5)
# Built-in visualization
spline.plot()
# S-curve motion profile (jerk-limited)
state = StateParams(q_0=0.0, q_1=10.0, v_0=0.0, v_1=0.0)
bounds = TrajectoryBounds(v_bound=5.0, a_bound=10.0, j_bound=30.0)
trajectory = DoubleSTrajectory(state, bounds)
print(f"Duration: {trajectory.get_duration():.2f}s")
trajectory.plot()
plt.show()
Algorithm Overview
| Category | Algorithms | Key Features | Use Cases |
|---|---|---|---|
| 🔵 Splines | Cubic, B-Spline, Smoothing | C² continuity, noise-robust | Waypoint interpolation, curve fitting |
| ⚡ Motion Profiles | S-curves, Trapezoidal, Polynomial | Bounded derivatives, time-optimal | Industrial automation, robotics |
| 🔄 Quaternions | SLERP, SQUAD, Splines | Smooth rotations, no gimbal lock | 3D orientation control, animation |
| 🎯 Path Planning | Linear, Circular, Frenet frames | Geometric primitives, tool orientation | Path following, machining |
📚 Complete Algorithms Reference →
Detailed technical documentation, mathematical foundations, and implementation details for all 22 algorithms
Complete Algorithm List
Spline Interpolation
CubicSpline– Natural cubic splines with boundary conditionsCubicSmoothingSpline– Noise-robust splines with smoothing parameterCubicSplineWithAcceleration1/2– Bounded acceleration constraintsBSpline– General B-spline curves with configurable degreeApproximationBSpline,CubicBSpline,InterpolationBSpline,SmoothingCubicBSpline
Motion Profiles
DoubleSTrajectory– S-curve profiles with bounded jerkTrapezoidalTrajectory– Classic trapezoidal velocity profilesPolynomialTrajectory– 3rd, 5th, 7th order polynomialsLinearPolyParabolicTrajectory– Linear segments with parabolic blends
Quaternion Interpolation
Quaternion– Core quaternion operations with SLERPQuaternionSpline– C²-continuous rotation trajectoriesSquadC2– Enhanced SQUAD with zero-clamped boundariesLogQuaternion– Logarithmic quaternion methods
Path Planning & Utilities
SimpleLinearPath,SimpleCircularPath– 3D geometric primitivesFrenetFrame– Frenet-Serret frame computation along curvesLinearInterpolation– Basic linear interpolationTridiagonalInverse– Efficient tridiagonal system solver
Advanced Examples
Quaternion Rotation Interpolation
import matplotlib.pyplot as plt
from interpolatepy import QuaternionSpline, Quaternion
# Define rotation waypoints
orientations = [
Quaternion.identity(),
Quaternion.from_euler_angles(0.5, 0.3, 0.1),
Quaternion.from_euler_angles(1.0, -0.2, 0.8)
]
times = [0.0, 2.0, 5.0]
# Smooth quaternion trajectory with C² continuity
quat_spline = QuaternionSpline(times, orientations, method="squad")
# Evaluate at any time
orientation = quat_spline.evaluate(3.5)
angular_velocity = quat_spline.evaluate_angular_velocity(3.5)
quat_spline.plot()
plt.show()
B-Spline Curve Fitting
import numpy as np
import matplotlib.pyplot as plt
from interpolatepy import SmoothingCubicBSpline
# Fit smooth curve to noisy data
t = np.linspace(0, 10, 50)
q = np.sin(t) + 0.1 * np.random.randn(50)
bspline = SmoothingCubicBSpline(t, q, smoothing=0.01)
bspline.plot()
plt.show()
Industrial Motion Planning
import numpy as np
import matplotlib.pyplot as plt
from interpolatepy import DoubleSTrajectory, StateParams, TrajectoryBounds
# Jerk-limited S-curve for smooth industrial motion
state = StateParams(q_0=0.0, q_1=50.0, v_0=0.0, v_1=0.0)
bounds = TrajectoryBounds(v_bound=10.0, a_bound=5.0, j_bound=2.0)
trajectory = DoubleSTrajectory(state, bounds)
print(f"Duration: {trajectory.get_duration():.2f}s")
# Evaluate trajectory
t_eval = np.linspace(0, trajectory.get_duration(), 1000)
positions = [trajectory.evaluate(t) for t in t_eval]
velocities = [trajectory.evaluate_velocity(t) for t in t_eval]
trajectory.plot()
plt.show()
Who Should Use InterpolatePy?
🤖 Robotics Engineers: Motion planning, trajectory optimization, smooth control
🎬 Animation Artists: Smooth keyframe interpolation, camera paths, character motion
🔬 Scientists: Data smoothing, curve fitting, experimental trajectory analysis
🏭 Automation Engineers: Industrial motion control, CNC machining, conveyor systems
Performance & Quality
- Fast: Vectorized NumPy operations, optimized algorithms
- Reliable: 85%+ test coverage, continuous integration
- Modern: Python 3.10+, strict typing, dataclass-based APIs
- Research-grade: Peer-reviewed algorithms from robotics literature
Typical Performance:
- Cubic spline (1000 points): ~1ms
- B-spline evaluation (10k points): ~5ms
- S-curve trajectory planning: ~0.5ms
Development
Development Setup
git clone https://github.com/GiorgioMedico/InterpolatePy.git
cd InterpolatePy
pip install -e '.[all]'
pre-commit install
# Run tests
python -m pytest tests/
# Run tests with coverage
python -m pytest tests/ --cov=interpolatepy --cov-report=html --cov-report=term
# Code quality
ruff format interpolatepy/
ruff check interpolatepy/
mypy interpolatepy/
Contributing
Contributions welcome! Please:
- Fork the repo and create a feature branch
- Install dev dependencies:
pip install -e '.[all]' - Follow existing patterns and add tests
- Run
pre-commit run --all-filesbefore submitting - Open a pull request with clear description
For major changes, open an issue first to discuss the approach.
Support the Project
⭐ Star the repo if InterpolatePy helps your work!
🐛 Report issues on GitHub Issues
💬 Join discussions to share your use cases and feedback
License & Citation
MIT License – Free for commercial and academic use. See LICENSE for details.
If you use InterpolatePy in research, please cite:
@misc{InterpolatePy,
author = {Giorgio Medico},
title = {InterpolatePy: Trajectory Planning and Interpolation for Python},
year = {2025},
url = {https://github.com/GiorgioMedico/InterpolatePy}
}
Academic References
This library implements algorithms from:
Robotics & Trajectory Planning:
- Biagiotti & Melchiorri (2008). Trajectory Planning for Automatic Machines and Robots
- Siciliano et al. (2010). Robotics: Modelling, Planning and Control
Quaternion Interpolation:
- Parker et al. (2023). "Logarithm-Based Methods for Interpolating Quaternion Time Series"
- Wittmann et al. (2023). "Spherical Cubic Blends: C²-Continuous Quaternion Interpolation"
- Dam, E. B., Koch, M., & Lillholm, M. (1998). "Quaternions, Interpolation and Animation"
Built with ❤️ for the robotics and scientific computing community.
Metadata
Release files for InterpolatePy 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| interpolatepy-2.0.0.tar.gz | 267.9 kB | Without provenance | Details for interpolatepy-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| interpolatepy-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for interpolatepy-2.0.0-py3-none-any.whl |
Total release size: 367.8 kB
Release files / interpolatepy-2.0.0.tar.gz
| Download URL | interpolatepy-2.0.0.tar.gz |
|---|---|
| Size | 267.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc65e638b9705afb406e8b828d1d63406abf4c3e66d9bdd02d12db2790ce3a08
|
|
BLAKE2b-256 checksum How to use checksums |
5af60cdd6909dac00c1cf48e5a83859949b37cdb18a80df26e20ff5afdfb1399
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Release files / interpolatepy-2.0.0-py3-none-any.whl
| Download URL | interpolatepy-2.0.0-py3-none-any.whl |
|---|---|
| Size | 99.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87ce8864a16ce2c7d55833e5c97a2a09da6eb5764cb1b223296acbcc4a313552
|
|
BLAKE2b-256 checksum How to use checksums |
92b6f5d4b16cadad6a6583e3d9eb35580fd9fbfc4a5a8b78b9247ed15fbd4d21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.18
|
Security for InterpolatePy 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.