testDerivatives.cpp
Go to the documentation of this file.
1 /*
2  * testDerivatives.cpp
3  *
4  * Created on: Aug 10, 2020
5  * Author: Ruben Grandia
6  * Institute: ETH Zurich
7  */
8 
9 #include <gtest/gtest.h>
10 
12 
13 using namespace grid_map;
14 using namespace signed_distance_field;
15 
16 TEST(testDerivatives, columnwise) {
17  Matrix data(2, 3);
18  data << 1.0, 2.0, 4.0, 2.0, 4.0, 6.0;
19 
20  float resolution{0.1F};
21  float doubleResolution{2.0F * resolution};
22 
23  Matrix manualDifference(2, 3);
24  manualDifference << 1.0 / resolution, 3.0 / doubleResolution, 2.0 / resolution, 2.0 / resolution, 4.0 / doubleResolution,
25  2.0 / resolution;
26 
27  Matrix computedDifference = Matrix::Zero(data.rows(), data.cols());
28  columnwiseCentralDifference(data, computedDifference, resolution);
29 
30  ASSERT_TRUE(manualDifference.isApprox(computedDifference));
31 }
Eigen::MatrixXf Matrix
void columnwiseCentralDifference(const Matrix &data, Matrix &centralDifference, float resolution)
TEST(GridMap, CopyConstructor)


grid_map_sdf
Author(s): Takahiro Miki , Péter Fankhauser
autogenerated on Wed Jul 5 2023 02:23:42