3#include <ossia/detail/config.hpp>
4#define TINYSPLINE_API OSSIA_EXPORT
14void ts_int_deboornet_init(
tsDeBoorNet* _deBoorNet_);
21void ts_int_bspline_init(
tsBSpline* spline);
33template <std::
size_t N>
41 ts_int_bspline_init(&m_spline);
42 ts_int_deboornet_init(&m_net);
48 ts_deboornet_free(&m_net);
50 ts_bspline_free(&m_spline);
53 operator bool() const noexcept {
return m_net.
pImpl; }
55 void set_points(
const tsReal* points, std::size_t numPoints)
noexcept
59 ts_deboornet_free(&m_net);
62 ts_bspline_free(&m_spline);
64 ts_int_bspline_init(&m_spline);
65 ts_bspline_new(numPoints, N, 3,
TS_CLAMPED, &m_spline, &status);
67 ts_bspline_set_control_points(&m_spline, points, &status);
69 ts_int_deboornet_init(&m_net);
70 ts_int_deboornet_new(&m_spline, &m_net, &status);
73 std::array<tsReal, N> evaluate(
double pos)
const noexcept
75 std::array<tsReal, N> res = {};
78 if(ts_int_bspline_eval_woa(&m_spline, pos, &m_net, &status) != 0)
85 const auto bytes = std::min(
86 (std::size_t)N *
sizeof(
tsReal), (std::size_t)ts_deboornet_sof_result(&m_net));
87 memcpy(res.data(), ts_int_deboornet_access_result(&m_net), bytes);
Definition tinyspline.h:718
Definition tinyspline.h:1308
struct tsDeBoorNetImpl * pImpl
Definition tinyspline.h:1309
Definition tinyspline.h:477
tsError
Definition tinyspline.h:426
double tsReal
Definition tinyspline.h:213
@ TS_CLAMPED
Definition tinyspline.h:647