#include <vec2.hpp>
template<typename value_type>
move::vectormath::generic_vec2_scalar struct

A two component vector that can store either floats or doubles. The underlying implementation is scalar.

Template parameters
value_type The type of the components of the vector

Public types

using component_type = value_type
The type of the components of the vector.

Public static variables

static static uint32_t num_components constexpr
The number of components in the vector.

Public static functions

static auto dot(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) -> MVM_INLINE_NODISCARD value_type noexcept
Returns the dot product of two vectors.
static auto distance_between_points(const generic_vec2_scalar& point1, const generic_vec2_scalar& point2) -> MVM_INLINE_NODISCARD value_type noexcept
Returns the euclidean distance between two vectors as if they were points in four dimensional space.
static auto squared_distance_between_points(const generic_vec2_scalar& point1, const generic_vec2_scalar& point2) -> MVM_INLINE_NODISCARD value_type noexcept
Returns the squared euclidean distance between two vectors as if they were points in four dimensional space.
static auto distance_to_line(const generic_vec2_scalar& point, const generic_vec2_scalar& v0, const generic_vec2_scalar& v1) -> MVM_INLINE_NODISCARD value_type noexcept
Calculates the distance between a point and a line defined by two points.
static auto cross(const generic_vec2_scalar& lhs, const generic_vec2_scalar& rhs) -> MVM_INLINE_NODISCARD value_type noexcept
Calculates the cross product of two vectors.
static auto angle_between_normalized_vectors(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) -> MVM_INLINE_NODISCARD value_type noexcept
Returns the angle between two normalized vectors.
static auto angle_between_vectors(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) -> MVM_INLINE_NODISCARD value_type noexcept
Returns the angle between two unnormalized vectors.
static auto reflect(const generic_vec2_scalar& incident, const generic_vec2_scalar& normal) -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Reflects incident across normal and returns the result.
static auto refract(const generic_vec2_scalar& incident, const generic_vec2_scalar& normal, value_type ior) -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Refracts incident across normal and returns the result.
static auto min(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector containing the minimum x, y, z, and w components of the two vectors.
static auto max(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector containing the maximum x, y, z, and w components of the two vectors.
static auto clamp(const generic_vec2_scalar& v, const generic_vec2_scalar& min, const generic_vec2_scalar& max) -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector the provided value clamped between the provided minimum and maximum vectors.
static auto filled(value_type value) -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with all components set to the provided value.
static auto infinity() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with all components set to infinity.
static auto negative_infinity() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with all components set to negative infinity.
static auto nan() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with all components set to NaN.
static auto zero() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with all components set to zero.
static auto negative_one() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with all components set to negative one.
static auto one() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with all components set to one.
static auto x_axis() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with the x component set to one and all other components set to zero.
static auto y_axis() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with the y component set to one and all other components set to zero.
static auto left() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with the x component set to negative one and all other components set to zero.
static auto right() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with the x component set to one and all other components set to zero.
static auto down() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with the y component set to negative one and all other components set to zero.
static auto up() -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a vector with the y component set to one and all other components set to zero.

Public functions

auto generic_vec2_scalar() -> MVM_INLINE_NODISCARD noexcept
Construct a new generic_vec2_scalar object.
auto generic_vec2_scalar(value_type x, value_type y = 0) -> MVM_INLINE_NODISCARD noexcept
Construct a new generic_vec2_scalar object.
template<typename Archive>
auto serialize(Archive& ar) -> MVM_INLINE void
Serializes the vector to/from an archive. Intended for use with Cereal and Cereal-like APIs.
auto operator==(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD bool noexcept
Determines if the vector is equal to another vector.
auto operator!=(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD bool noexcept
Determines if the vector is not equal to another vector.
auto operator<(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD bool noexcept
Determines if all components of the vector are less than the corresponding components of another vector.
auto operator<=(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD bool noexcept
Determines if all components of the vector are less than or equal to the corresponding components of another vector.
auto operator>(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD bool noexcept
Determines if all components of the vector are greater than the corresponding components of another vector.
auto operator>=(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD bool noexcept
Determines if all components of the vector are greater than or equal to the corresponding components of another vector.
auto operator=(const generic_vec2_scalar& v) -> MVM_INLINE generic_vec2_scalar& noexcept
Assigns the contents of another vector to this vector.
auto operator+=(const generic_vec2_scalar& v) -> MVM_INLINE generic_vec2_scalar& noexcept
Adds another vector to this vector and stores the result in this vector.
auto operator-=(const generic_vec2_scalar& v) -> MVM_INLINE generic_vec2_scalar& noexcept
Subtracts another vector from this vector and stores the result in this vector.
auto operator*=(const value_type& v) -> MVM_INLINE generic_vec2_scalar& noexcept
Multiplies this vector by a scalar and stores the result in this vector.
auto operator*=(const generic_vec2_scalar& v) -> MVM_INLINE generic_vec2_scalar& noexcept
Multiplies this vector by another vector component-wise and stores the result in this vector.
auto operator/=(const value_type& v) -> MVM_INLINE generic_vec2_scalar& noexcept
Divides this vector by a scalar and stores the result in this vector.
auto operator/=(const generic_vec2_scalar& v) -> MVM_INLINE generic_vec2_scalar& noexcept
Divides this vector by another vector component-wise and stores the result in this vector.
auto operator+(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Adds the other vector to this vector and returns the result. Does not modify this vector.
auto operator-(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Subtracts a vector from this vector and returns the result. Does not modify this vector.
auto operator*(const value_type& v) const -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Multiplies this vector by a scalar and returns the result. Does not modify this vector.
auto operator*(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Multiplies this vector by another vector component-wise and returns the result. Does not modify this vector.
auto operator/(const value_type& v) const -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Divides this vector by a scalar and returns the result. Does not modify this vector.
auto operator/(const generic_vec2_scalar& v) const -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Divides this vector by another vector component-wise and returns the result. Does not modify this vector.
auto operator-() const -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Negates the vector and returns the result. Does not modify this vector.
auto get_component(int index) const -> MVM_INLINE_NODISCARD value_type noexcept
Returns the component at the specified index. If the index is out of range, the result is undefined.
auto set_component(int index, value_type value) -> MVM_INLINE void
Sets the component at the specified index. If the index is out of range, the result is undefined.
auto operator[](int i) const -> MVM_INLINE_NODISCARD value_type noexcept
Returns the component at the specified index. If the index is out of range, the result is undefined. Currently the w component is returned.
auto x() const -> MVM_INLINE_NODISCARD value_type noexcept
Returns the x component of the vector.
auto y() const -> MVM_INLINE_NODISCARD value_type noexcept
Returns the y component of the vector.
auto x(value_type x) -> MVM_INLINE_NODISCARD generic_vec2_scalar& noexcept
Sets the x component of the vector.
auto y(value_type y) -> MVM_INLINE_NODISCARD generic_vec2_scalar& noexcept
Sets the y component of the vector.
auto set_x(value_type x) -> MVM_INLINE generic_vec2_scalar& noexcept
Sets the x component of the vector.
auto set_y(value_type y) -> MVM_INLINE generic_vec2_scalar& noexcept
Sets the y component of the vector.
auto fill(value_type v) -> MVM_INLINE_NODISCARD generic_vec2_scalar& noexcept
Sets all components of the vector to the same value.
auto set(value_type x, value_type y) -> MVM_INLINE_NODISCARD generic_vec2_scalar& noexcept
Sets the x and y components of the vector.
auto set(const generic_vec2_scalar& rhs) -> MVM_INLINE_NODISCARD generic_vec2_scalar& noexcept
Sets the x and y components of the vector.
auto length() const -> MVM_INLINE_NODISCARD value_type noexcept
Returns the length of the vector.
auto squared_length() const -> MVM_INLINE_NODISCARD value_type noexcept
Returns the squared length of the vector.
auto reciprocal_length() const -> MVM_INLINE_NODISCARD value_type noexcept
Returns the reciprocal length of the vector.
auto normalized() const -> MVM_INLINE_NODISCARD generic_vec2_scalar noexcept
Returns a normalized copy of the vector.
auto normalize() -> MVM_INLINE void noexcept
Normalizes the vector.

Function documentation

template<typename value_type>
static MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::dot(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) noexcept

Returns the dot product of two vectors.

Parameters
v1 The first vector
v2 The second vector

template<typename value_type>
static MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::distance_to_line(const generic_vec2_scalar& point, const generic_vec2_scalar& v0, const generic_vec2_scalar& v1) noexcept

Calculates the distance between a point and a line defined by two points.

Parameters
point The point
v0 The first point on the line
v1 The second point on the line
Returns value_type The distance between the point and the line

template<typename value_type>
static MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::cross(const generic_vec2_scalar& lhs, const generic_vec2_scalar& rhs) noexcept

Calculates the cross product of two vectors.

Returns value_type The cross product of the two vectors

template<typename value_type>
static MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::angle_between_normalized_vectors(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) noexcept

Returns the angle between two normalized vectors.

Parameters
v1 The first vector
v2 The second vector
Returns value_type The angle between the two vectors

template<typename value_type>
static MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::angle_between_vectors(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) noexcept

Returns the angle between two unnormalized vectors.

Parameters
v1 The first vector
v2 The second vector
Returns value_type The angle between the two vectors

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::reflect(const generic_vec2_scalar& incident, const generic_vec2_scalar& normal) noexcept

Reflects incident across normal and returns the result.

Parameters
incident The incident vector
normal The normal vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::refract(const generic_vec2_scalar& incident, const generic_vec2_scalar& normal, value_type ior) noexcept

Refracts incident across normal and returns the result.

Parameters
incident The incident vector
normal The normal vector
ior The index of refraction

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::min(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) noexcept

Returns a vector containing the minimum x, y, z, and w components of the two vectors.

Parameters
v1 The first vector
v2 The second vector
Returns generic_vec2_scalar The minimum vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::max(const generic_vec2_scalar& v1, const generic_vec2_scalar& v2) noexcept

Returns a vector containing the maximum x, y, z, and w components of the two vectors.

Parameters
v1 The first vector
v2 The second vector
Returns generic_vec2_scalar The maximum vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::clamp(const generic_vec2_scalar& v, const generic_vec2_scalar& min, const generic_vec2_scalar& max) noexcept

Returns a vector the provided value clamped between the provided minimum and maximum vectors.

Parameters
v The vector to clamp
min The minimum vector
max The maximum vector
Returns generic_vec2_scalar The clamped vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::filled(value_type value) noexcept

Returns a vector with all components set to the provided value.

Parameters
value The value to set all components to
Returns generic_vec2_scalar The filled vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::infinity() noexcept

Returns a vector with all components set to infinity.

Returns generic_vec2_scalar The infinity vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::negative_infinity() noexcept

Returns a vector with all components set to negative infinity.

Returns generic_vec2_scalar The infinity vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::nan() noexcept

Returns a vector with all components set to NaN.

Returns generic_vec2_scalar The NaN vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::zero() noexcept

Returns a vector with all components set to zero.

Returns generic_vec2_scalar The zero vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::negative_one() noexcept

Returns a vector with all components set to negative one.

Returns generic_vec2_scalar The negative one vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::one() noexcept

Returns a vector with all components set to one.

Returns generic_vec2_scalar The one vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::x_axis() noexcept

Returns a vector with the x component set to one and all other components set to zero.

Returns generic_vec2_scalar The x axis vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::y_axis() noexcept

Returns a vector with the y component set to one and all other components set to zero.

Returns generic_vec2_scalar The y axis vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::left() noexcept

Returns a vector with the x component set to negative one and all other components set to zero.

Returns generic_vec2_scalar The left vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::right() noexcept

Returns a vector with the x component set to one and all other components set to zero.

Returns generic_vec2_scalar The right vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::down() noexcept

Returns a vector with the y component set to negative one and all other components set to zero.

Returns generic_vec2_scalar The down vector

template<typename value_type>
static MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::up() noexcept

Returns a vector with the y component set to one and all other components set to zero.

Returns generic_vec2_scalar The up vector

template<typename value_type>
MVM_INLINE_NODISCARD move::vectormath::generic_vec2_scalar<value_type>::generic_vec2_scalar() noexcept

Construct a new generic_vec2_scalar object.

Returns generic_vec2_scalar A new vector initialized to (0, 0)

template<typename value_type>
MVM_INLINE_NODISCARD move::vectormath::generic_vec2_scalar<value_type>::generic_vec2_scalar(value_type x, value_type y = 0) noexcept

Construct a new generic_vec2_scalar object.

Returns generic_vec2_scalar A new vector initialized to (x, y)

template<typename value_type> template<typename Archive>
MVM_INLINE void move::vectormath::generic_vec2_scalar<value_type>::serialize(Archive& ar)

Serializes the vector to/from an archive. Intended for use with Cereal and Cereal-like APIs.

Template parameters
Archive The archive type
Parameters
ar The archive

template<typename value_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_vec2_scalar<value_type>::operator==(const generic_vec2_scalar& v) const noexcept

Determines if the vector is equal to another vector.

Parameters
v The other vector
Returns true The vectors are equal

template<typename value_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_vec2_scalar<value_type>::operator!=(const generic_vec2_scalar& v) const noexcept

Determines if the vector is not equal to another vector.

Parameters
v The other vector
Returns true The vectors are not equal

template<typename value_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_vec2_scalar<value_type>::operator<(const generic_vec2_scalar& v) const noexcept

Determines if all components of the vector are less than the corresponding components of another vector.

Parameters
v The other vector
Returns true All components of the vector are less than the corresponding components of the other vector

template<typename value_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_vec2_scalar<value_type>::operator<=(const generic_vec2_scalar& v) const noexcept

Determines if all components of the vector are less than or equal to the corresponding components of another vector.

Parameters
v The other vector
Returns true All components of the vector are less than or equal to the corresponding components of the other vector

template<typename value_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_vec2_scalar<value_type>::operator>(const generic_vec2_scalar& v) const noexcept

Determines if all components of the vector are greater than the corresponding components of another vector.

Parameters
v The other vector
Returns true All components of the vector are greater than the corresponding components of the other vector

template<typename value_type>
MVM_INLINE_NODISCARD bool move::vectormath::generic_vec2_scalar<value_type>::operator>=(const generic_vec2_scalar& v) const noexcept

Determines if all components of the vector are greater than or equal to the corresponding components of another vector.

Parameters
v The other vector
Returns true All components of the vector are greater than or equal to the corresponding components of the other vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::operator=(const generic_vec2_scalar& v) noexcept

Assigns the contents of another vector to this vector.

Parameters
v The other vector
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::operator+=(const generic_vec2_scalar& v) noexcept

Adds another vector to this vector and stores the result in this vector.

Parameters
v The other vector
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::operator-=(const generic_vec2_scalar& v) noexcept

Subtracts another vector from this vector and stores the result in this vector.

Parameters
v The other vector
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::operator*=(const value_type& v) noexcept

Multiplies this vector by a scalar and stores the result in this vector.

Parameters
v The scalar
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::operator*=(const generic_vec2_scalar& v) noexcept

Multiplies this vector by another vector component-wise and stores the result in this vector.

Parameters
v The other vector
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::operator/=(const value_type& v) noexcept

Divides this vector by a scalar and stores the result in this vector.

Parameters
v The scalar
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::operator/=(const generic_vec2_scalar& v) noexcept

Divides this vector by another vector component-wise and stores the result in this vector.

Parameters
v The other vector
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::operator+(const generic_vec2_scalar& v) const noexcept

Adds the other vector to this vector and returns the result. Does not modify this vector.

Parameters
v The other vector
Returns generic_vec2_scalar The result of the addition

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::operator-(const generic_vec2_scalar& v) const noexcept

Subtracts a vector from this vector and returns the result. Does not modify this vector.

Parameters
v The other vector
Returns generic_vec2_scalar The result of the subtraction

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::operator*(const value_type& v) const noexcept

Multiplies this vector by a scalar and returns the result. Does not modify this vector.

Parameters
v The scalar
Returns generic_vec2_scalar The result of the multiplication

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::operator*(const generic_vec2_scalar& v) const noexcept

Multiplies this vector by another vector component-wise and returns the result. Does not modify this vector.

Parameters
v The other vector
Returns generic_vec2_scalar The result of the multiplication

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::operator/(const value_type& v) const noexcept

Divides this vector by a scalar and returns the result. Does not modify this vector.

Parameters
v The scalar
Returns generic_vec2_scalar The result of the division

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::operator/(const generic_vec2_scalar& v) const noexcept

Divides this vector by another vector component-wise and returns the result. Does not modify this vector.

Parameters
v The other vector
Returns generic_vec2_scalar The result of the division

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::operator-() const noexcept

Negates the vector and returns the result. Does not modify this vector.

Returns generic_vec2_scalar The negated vector

template<typename value_type>
MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::get_component(int index) const noexcept

Returns the component at the specified index. If the index is out of range, the result is undefined.

Parameters
index The index of the component to return
Returns value_type The component at the specified index

template<typename value_type>
MVM_INLINE void move::vectormath::generic_vec2_scalar<value_type>::set_component(int index, value_type value)

Sets the component at the specified index. If the index is out of range, the result is undefined.

Parameters
index The index of the component to set
value The new value for the component

template<typename value_type>
MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::operator[](int i) const noexcept

Returns the component at the specified index. If the index is out of range, the result is undefined. Currently the w component is returned.

Returns value_type The component at the specified index

template<typename value_type>
MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::x() const noexcept

Returns the x component of the vector.

Returns value_type The x component

template<typename value_type>
MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::y() const noexcept

Returns the y component of the vector.

Returns value_type The y component

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::x(value_type x) noexcept

Sets the x component of the vector.

Parameters
x The new x component
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::y(value_type y) noexcept

Sets the y component of the vector.

Parameters
y The new y component
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::set_x(value_type x) noexcept

Sets the x component of the vector.

Parameters
x The new x component
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::set_y(value_type y) noexcept

Sets the y component of the vector.

Parameters
y The new y component
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::fill(value_type v) noexcept

Sets all components of the vector to the same value.

Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::set(value_type x, value_type y) noexcept

Sets the x and y components of the vector.

Parameters
x The new x component
y The new y component
Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar& move::vectormath::generic_vec2_scalar<value_type>::set(const generic_vec2_scalar& rhs) noexcept

Sets the x and y components of the vector.

Returns generic_vec2_scalar& A reference to the vector

template<typename value_type>
MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::length() const noexcept

Returns the length of the vector.

Returns value_type The length of the vector

template<typename value_type>
MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::squared_length() const noexcept

Returns the squared length of the vector.

Returns value_type The squared length of the vector

template<typename value_type>
MVM_INLINE_NODISCARD value_type move::vectormath::generic_vec2_scalar<value_type>::reciprocal_length() const noexcept

Returns the reciprocal length of the vector.

Returns value_type The reciprocal length of the vector

template<typename value_type>
MVM_INLINE_NODISCARD generic_vec2_scalar move::vectormath::generic_vec2_scalar<value_type>::normalized() const noexcept

Returns a normalized copy of the vector.

Returns generic_vec2_scalar The normalized vector

template<typename value_type>
MVM_INLINE void move::vectormath::generic_vec2_scalar<value_type>::normalize() noexcept

Normalizes the vector.

Returns generic_vec4_rtm& A reference to the vector