Есть путь х1 и штука, которую я разгоняю до момента t1, а потом на протяжении t2, торможу до 0. Но она не тормозится :(
for(int i = 1; i < N; i++)
{
t = Tp * i; //Тр = (t1[Condition] + t2[Condition]) / (double)N
if(t <= t1[Condition])
{
//ГАЗ
Y[Condition] = a1[Condition] * t;
X[Condition] = a1[Condition] * pow(t,2.0) / 2;
Vmax[Condition] = Y[Condition];
//Vo = Y[Condition];
//Xo = X[Condition];
}else
{
//Тормоз
//Y[Condition] = Vmax[Condition] - a2[Condition] * t;
//X[Condition] = Xo - Vo * t - (a2[Condition]*t*t) / 2;
Y[Condition] = a1[Condition] * t1[Condition] - a2[Condition] * (t - t1[Condition]);
X[Condition] = a1[Condition] * pow(t1[Condition],2.0) / 2 +
a1[Condition] * t1[Condition] * (t - t1[Condition]) + a2[Condition] * pow(t - t1[Condition],2) / 2;
}
}
Время считал так:
t1[Condition] = sqrt(
(2.0 * a2[Condition] * ui->x1->value())
/
( pow(a1[Condition], 2.0) + a1[Condition] * a2[Condition])
);
t2[Condition] = sqrt(
(2.0 * a1[Condition] * ui->x1->value() )
/
( pow(a2[Condition], 2.0) + a1[Condition] * a2[Condition])
);