PyBezier
is a Python library for calculating Bezier curves.
This library provides an easy-to-use Python interface while leveraging C++ for computational efficiency.
In the fields of Aerodynamics, Fluid mechanics, and Modeling, it's often essential to describe complex curves accurately. One approach involves the use of Bezier curves, which are widely applied in computer graphics because of their smoothness and intuitive control.
The goal is to use multiple third-order (or higher order) Bezier curves to fit the following types of curves:
pybind11
git clone https://github.com/yourusername/pybezier.git
cd pybezier
mkdir build
cd build
cmake ..
make
This will build the C++ extension and place it in the correct location for Python to access.
Once the C++ extension is built, you can use the library in Python to compute Bezier curves:
from pybezier import compute_bezier
# Define control points
points = [(0, 0), (1, 2), (3, 3)]
# Compute the point on the Bezier curve for t = 0.5
result = compute_bezier(points, 0.5)
print(result)
This project uses pytest
for testing. To run the tests:
Install pytest
if you haven't already:
pip install pytest
Run the tests:
cd build
make pytest