#include <cmath>
#include <cstddef>
#include <iostream>
#include <vector>
#include <copp/copp.hpp>
int main()
{
constexpr std::size_t dim = 2;
auto path = copp::Path::from_evaluator_2nd(
dim,
0.0,
1.0,
[](copp::Span<const double> s,
copp::MatrixRef q,
copp::MatrixRef dq,
copp::MatrixRef ddq) {
for (std::size_t j = 0; j < s.size(); ++j)
{
const double x = s[j];
q(0, j) = x;
dq(0, j) = 1.0;
ddq(0, j) = 0.0;
q(1, j) = std::sin(x);
dq(1, j) = std::cos(x);
ddq(1, j) = -std::sin(x);
}
});
std::vector<double> samples{0.0, 0.5, 1.0};
auto out = path.evaluate_up_to_2nd(samples);
std::cout << "dim = " << path.dim() << "\n";
std::cout << "q(1, 1) = " << out.q(1, 1) << "\n";
std::cout << "dq(1, 1) = " << out.dq.value()(1, 1) << "\n";
std::cout << "ddq(1, 1) = " << out.ddq.value()(1, 1) << "\n";
}