Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathanhliu21/hermite
https://github.com/jonathanhliu21/hermite
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/jonathanhliu21/hermite
- Owner: jonathanhliu21
- License: mit
- Created: 2023-05-22T06:01:19.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-27T21:13:02.000Z (over 1 year ago)
- Last Synced: 2024-06-21T22:29:25.607Z (7 months ago)
- Language: C++
- Homepage: https://jonathanhliu21.github.io/hermite/
- Size: 1020 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Welcome to hermite
Hermite is a C++ library for computing cubic Hermite splines and natural cubic splines (mainly for robotics).
## Installation
Install the library:
```sh
$ cmake -B build -DCMAKE_BUILD_TYPE=Release
$ cmake --build build --target install
```Then place the code below:
```cmake
cmake_minimum_required(VERSION 3.16.3)
project(MyProject LANGUAGES CXX)
find_package(hermite REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main PRIVATE hermite::hermite)
```The include path will be like so:
```cpp
#include // for cubic splines
#include // for hermite splines
```### Local installation
To install locally, you can clone the repository, then copy the folders containing the source code (i.e. the `include/hermite` folder) into your codebase.
## Example usage
Below is example code:
```cpp
#include
#include#include
int main() {
// create hermite object
hermite::Hermite<1> h;// create poses
hermite::Pose<1> p0{-3, {-2}, {0}};
hermite::Pose<1> p1{0, {2}, {1}};
hermite::Pose<1> p2{2, {3}, {2}};
hermite::Pose<1> p3{6, {0}, {0}};// add poses into hermite object
h.insert(p0);
h.insert(p1);
h.insert(p2);
h.insert(p3);// calculate position, velocity, acceleration vectors
svector::Vector<1> pos1 = h.getPos(-1.5);
svector::Vector<1> vel1 = h.getVel(-1.5);
svector::Vector<1> acc1 = h.getAcc(-1.5);std::cout << pos1.toString() << std::endl; // <-0.375>
std::cout << vel1.toString() << std::endl; // <1.75>
std::cout << acc1.toString() << std::endl; // <0.333>
}
```