3#include "structure/math/spk_safe_comparand.hpp"
4#include "structure/math/spk_vector2.hpp"
26 Force2D(
const spk::Vector2 &p_direction,
const float &p_magnitude) :
48 const float length = p_vector.
length();
53 return Force2D(p_vector / length, length);
spk::Vector2 direction
Normalized direction of the force.
Definition spk_force_2d.hpp:15
Force2D(const spk::Vector2 &p_direction, const float &p_magnitude)
Creates a force from direction and magnitude.
Definition spk_force_2d.hpp:26
Force2D()=default
Creates a zero force.
float magnitude
Force magnitude.
Definition spk_force_2d.hpp:17
static Force2D fromVector(const spk::Vector2 &p_vector)
Builds a force from a vector.
Definition spk_force_2d.hpp:46
spk::Vector2 vector() const
Returns the force vector.
Definition spk_force_2d.hpp:36
float length() const
Computes Euclidean length.
Definition spk_vector2.hpp:490
Wraps arithmetic values to compare with tolerance for floating-point inputs.
Definition spk_safe_comparand.hpp:17