MCPcopy Create free account
hub / github.com/Bziyue/SplineTrajectory / generateRandomData

Function generateRandomData

test_Grad.cpp:100–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void generateRandomData(int N,
101 std::vector<double> &times,
102 PointsMatrix3D &all_points,
103 Eigen::Matrix3Xd &inner_points_mat,
104 Eigen::MatrixXd &inner_points_ref_format) // 3x(N-1)
105{
106 std::random_device rd;
107 std::mt19937 gen(rd());
108 std::uniform_real_distribution<> dis_t(0.5, 2.0);
109 std::uniform_real_distribution<> dis_p(-10.0, 10.0);
110
111 times.resize(N);
112 all_points.resize(N + 1, 3);
113 inner_points_mat.resize(3, N - 1);
114
115 for (int i = 0; i < N; ++i)
116 times[i] = dis_t(gen);
117
118 for (int i = 0; i <= N; ++i)
119 {
120 all_points.row(i) = Eigen::Vector3d(dis_p(gen), dis_p(gen), dis_p(gen)).transpose();
121 if (i > 0 && i < N)
122 {
123 inner_points_mat.col(i - 1) = all_points.row(i).transpose();
124 }
125 }
126 inner_points_ref_format = inner_points_mat;
127}
128
129// ---------------------------------------------------------
130// Test 1: Cubic Spline (Min Acc) vs MINCO S2

Callers 3

testCubicFunction · 0.85
testQuinticFunction · 0.85
testSepticFunction · 0.85

Calls 1

resizeMethod · 0.45

Tested by

no test coverage detected