This repo was made to cleanup the compilation process of Enrico Bertolazzi Clothoids.
This repository uses git submodules to keep always a stable version.
git clone --recurse-submodules https://github.com/Pippo98/clothoidsDirectly from GitHub (pip fetches the submodules on its own):
pip install git+https://github.com/Pippo98/clothoidsOr from a local clone (cloned with --recurse-submodules):
pip install .A C++17 compiler is required; CMake is downloaded automatically if the installed one is too old.
import py_clothoids
cl = py_clothoids.ClothoidList("my_curve")
cl.build_G1(n=4, x=[0, 1, 2, 3], y=[0, 1, 0, 1])
print(cl.length())
r = cl.evaluate(s=0.5) # EvalResult(th=..., k=..., x=..., y=...)
th, k, x, y = r # results can also be unpacked like tuplesThe package ships type stubs (py_clothoids/_core.pyi), so IDEs autocomplete methods, argument names and documentation.
After changing bindings/py/bindings.cpp, regenerate and commit them with:
bindings/py/generate_stubs.shcmake -B build
cmake --build build
If you want to integrate the clothoids in your CMake project, you should add this repository as submodule in your project to make it available to CMake, then:
# ...
add_subdirectory(external/clothiods) # this is the case if this repo is placed in the "external" subdirectory
target_link_libraries(
my_executable_or_library
PUBLIC
clothoids # this is the name of the library compiled in this repository
)By default this project compiles a static library, however if you want to change the library type you can set the SET_CLOTHOID_LIB_TYPE variable in two ways:
- From command line:
cmake -B build -DSET_CLOTHOID_LIB_TYPE=SHARED - Directly in cmake by adding
set(SET_CLOTHOID_LIB_TYPE SHARED)before the lineadd_subdirectory.