28 #include "../exceptions/InterpolationNotDefinedException.h"
29 #include "../exceptions/NoInterpolationPossibleException.h"
32 using namespace alglib;
36 if (controlPoints.size() <
static_cast<unsigned>(3))
43 alglib::pspline2build(getCoordinateArray(0), controlPoints.size(), 2, 0, xInterpolation);
44 alglib::pspline2build(getCoordinateArray(1), controlPoints.size(), 2, 0, yInterpolation);
45 alglib::pspline2build(getCoordinateArray(2), controlPoints.size(), 2, 0, zInterpolation);
49 if (time < 0 || time > 1)
61 alglib::pspline2calc(xInterpolation, time, x, temp);
62 alglib::pspline2calc(yInterpolation, time, y, temp);
63 alglib::pspline2calc(zInterpolation, time, z, temp);
65 Vector3BasePtr position =
new Vector3(x, y, z);
66 QuaternionBasePtr base = this->calculateOrientationAt(time);
67 return *
new PoseBasePtr(
new Pose(position, base));
74 for (
unsigned int i = 0; i < controlPoints.size(); i++)
76 if (controlPoints.at(i) == start)
92 alglib::real_2d_array SplineInterpolation::getCoordinateArray(
int coordinate)
94 std::string transformation =
"[";
96 for (PoseBasePtr current : controlPoints)
102 temp = current->position->x;
105 temp = current->position->y;
108 temp = current->position->z;
112 if (i != controlPoints.size() - 1)
114 transformation +=
",";
118 transformation +=
"]";
119 const char*
c = transformation.c_str();
120 real_2d_array
input = *
new real_2d_array(
c);