mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
small fixes
This commit is contained in:
@@ -18,7 +18,7 @@ namespace omath
|
||||
// Constructors
|
||||
constexpr Vector2() : x(0.f), y(0.f) {}
|
||||
|
||||
constexpr Vector2(float x, float y) : x(x), y(y) {}
|
||||
constexpr Vector2(const float x, const float y) : x(x), y(y) {}
|
||||
|
||||
// Equality operators
|
||||
[[nodiscard]]
|
||||
|
||||
@@ -48,10 +48,11 @@ namespace omath::prediction
|
||||
const auto delta = targetPosition - projectile.m_origin;
|
||||
|
||||
const auto distance2d = delta.Length2D();
|
||||
const auto distance2dSqr = distance2d * distance2d;
|
||||
const auto launchSpeedSqr = projectile.m_launchSpeed * projectile.m_launchSpeed;
|
||||
|
||||
|
||||
float root = std::pow(projectile.m_launchSpeed, 4.f) - bulletGravity * (bulletGravity *
|
||||
std::pow(distance2d, 2.f) + 2.0f * delta.z * std::pow(projectile.m_launchSpeed, 2.f));
|
||||
float root = launchSpeedSqr * launchSpeedSqr - bulletGravity * (bulletGravity *
|
||||
distance2dSqr + 2.0f * delta.z * launchSpeedSqr);
|
||||
|
||||
if (root < 0.0f) [[unlikely]]
|
||||
return std::nullopt;
|
||||
|
||||
Reference in New Issue
Block a user