12 hours ago, fmatak said:
I did some napkin calculations, and found below result. Not 100% sure, so verify before using:
t = 1/a.( atan( ( d + e.cos(a) ) / e.sin(a) ) ) )
Assuming you know a, d and e and can calculate arc tan relatively easily.
Thanks, but seems wrong.
You forgot a brace, i tried those options, but they are both wrong:
float a = 1.3f;
float d = 0.7f;
float e = 0.9f;
// try to solve
// sin(a*t) * d = sin(a*(1-t)) * e
// for t
{
float t = 1 / a * ( atan( ( d + e*cos(a) ) / e*sin(a) ) );
float proofLHS = sin(a*t) * d;
float proofRHS = sin(a*(1-t)) * e;
ImGui::Text ("(1) lhs %f != rhs %f", proofLHS, proofRHS);
}
{
float t = 1 / (a * ( atan( ( d + e*cos(a) ) / e*sin(a) ) ) );
float proofLHS = sin(a*t) * d;
float proofRHS = sin(a*(1-t)) * e;
ImGui::Text ("(2) lhs %f != rhs %f", proofLHS, proofRHS);
}
{
static float t = 0.573;
ImGui::DragFloat("t", &t, 0.0001f);
float proofLHS = sin(a*t) * d;
float proofRHS = sin(a*(1-t)) * e;
ImGui::Text ("(3) lhs %f != rhs %f", proofLHS, proofRHS);
}
output:
(1) lhs 0.496743 != rhs 0.440162 (small error but with other numbers it's large)
(2) lhs 0.668042 != rhs 0.029278
(3) lhs 0.474529 != rhs 0.474325
I've had no luck myself yet either...