9 #include "gmock/gmock.h" 10 #include "gtest/gtest.h" 13 TEST(Math, InterpolateLinear) {
21 EXPECT_TRUE(
almostEqual(yInterp, yInterpRef, .001));
25 TEST(Math, BezierInterpolationFirstDerivative) {
34 Vec3<double> dyInterpDxRef = (yInterpXdx - yInterpX) / dx;
38 EXPECT_TRUE(
almostEqual(dyInterpDx, dyInterpDxRef, .001));
40 for (
int i = 0; i < 3; i++) {
41 EXPECT_TRUE(yInterpX(i) > y0(i) && yInterpX(i) < y1(i));
46 TEST(Math, BezierInterpolationSecondDerivative) {
56 Vec3<double> dyInterpDxRef = (yInterpXdx - yInterpX) / dx;
60 EXPECT_TRUE(
almostEqual(dyInterpDx, dyInterpDxRef, .001));
typename Eigen::Matrix< T, 3, 1 > Vec3
y_t lerp(y_t y0, y_t yf, x_t x)
y_t cubicBezierFirstDerivative(y_t y0, y_t yf, x_t x)
y_t cubicBezier(y_t y0, y_t yf, x_t x)
TEST(Math, InterpolateLinear)
bool almostEqual(const Eigen::MatrixBase< T > &a, const Eigen::MatrixBase< T > &b, T2 tol)
Utility functions to interpolate between two values.
Utility functions for math.
y_t cubicBezierSecondDerivative(y_t y0, y_t yf, x_t x)