Quick refactoring and reformating
This commit is contained in:
parent
1c58530e98
commit
4a7e5834d3
@ -43,7 +43,9 @@ static bool separating_axis(
|
|||||||
max_q = std::max(max_q, projection);
|
max_q = std::max(max_q, projection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_p >= min_q && max_q >= min_p) {
|
if (max_p < min_q || max_q < min_p)
|
||||||
|
return true;
|
||||||
|
|
||||||
double d;
|
double d;
|
||||||
if (max_q - min_p < max_p - min_q) {
|
if (max_q - min_p < max_p - min_q) {
|
||||||
d = max_q - min_p;
|
d = max_q - min_p;
|
||||||
@ -52,12 +54,11 @@ static bool separating_axis(
|
|||||||
d = max_p - min_q;
|
d = max_p - min_q;
|
||||||
*impact_point = max_p_point;
|
*impact_point = max_p_point;
|
||||||
}
|
}
|
||||||
// push a bit more than needed so the shapes do not overlap in future
|
// push a bit more than needed so the shapes do not overlap in
|
||||||
// tests due to float precision
|
// future tests due to float precision
|
||||||
double d_over_o_squared = d / vec2d::dot(axis, axis) + 1e-10;
|
double d_over_o_squared = d / vec2d::dot(axis, axis) + 1e-10;
|
||||||
*pv = d_over_o_squared * axis;
|
*pv = d_over_o_squared * axis;
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user