96 double dt1 = std::abs((dec_max - a0) / (-j * d));
99 double v1 =
v(dt1, v0, a0, -d * j);
100 double acc_duration = std::abs(dec_max) / j;
102 v(acc_duration, 0, 0, d * j);
105 double dt2 = d * ((v1 - v2) / dec_max);
108 double dt3 =
t_to_v(std::abs(v2), 0, j);
109 double s1 =
s(dt1, 0, v0, a0, d * j);
110 double s2 =
s(dt2, 0, v1, dec_max, 0);
111 double s3 =
s(dt3, 0, v2, dec_max, d * j);
112 double v3 =
v(dt3, v2, dec_max, d * j);
113 double s_total = s1 + s2 + s3;
118 double delta_a =
a(excess_time / 2, 0, d * j);
119 a_max -= d * delta_a;
120 dec_max = std::abs(dec_max) - std::abs(delta_a);
125 return {s_total * d, v1, v2, v3, dt1, dt2, dt3};
172 double part = j * v0 - a0 * a0 / 2.0;
179 throw std::runtime_error(
"unsuitable parameters! : j: " + std::to_string(j) +
180 " a0: " + std::to_string(a0) +
" v0: " + std::to_string(v0));
182 double t1 = std::sqrt(part) / j;
183 double t2 = (a0 / j) + t1;
184 double v1 =
v(t1, v0, a0, -j);
187 double a1 =
a(t1, -a0, -j);
189 double v2 =
v(t2, v1, a1, j);
192 double a2 =
a(t2, a1, j);
195 double s1 =
s(t1, 0, v0, a0, -j);
196 double s2 =
s(t2, 0, v1, a1, j);
197 double s_total = s1 + s2;
198 return {s_total, s1, s2, d * v1, d * v2, d * a1, d * a2, t1 + t2, t1, t2};