#include <vec3_scalar.hpp>
template<typename value_type>
generic_vec3_scalar struct
A three component vector that can store either floats or doubles. The underlying implementation is basic scalar math.
Template parameters | |
---|---|
value_type | The type of the components of the vector |
Contents
Public types
- using component_type = value_type
Public static variables
- static static uint32_t num_components constexpr
Public static functions
-
static auto dot(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2) -> MVM_INLINE_NODISCARD value_type noexcept - Returns the dot product of two vectors.
-
static auto distance_between_points(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2) -> 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_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2) -> 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_
vec3_ scalar& point, const generic_ vec3_ scalar& v0, const generic_ vec3_ 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_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Calculates the cross product of two vectors.
-
static auto angle_between_normalized_vectors(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2) -> MVM_INLINE_NODISCARD value_type noexcept - Returns the angle between two normalized vectors.
-
static auto angle_between_vectors(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2) -> MVM_INLINE_NODISCARD value_type noexcept - Returns the angle between two unnormalized vectors.
-
static auto reflect(const generic_
vec3_ scalar& incident, const generic_ vec3_ scalar& normal) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Reflects incident across normal and returns the result.
-
static auto refract(const generic_
vec3_ scalar& incident, const generic_ vec3_ scalar& normal, value_type ior) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Refracts incident across normal and returns the result.
-
static auto lerp_unclamped(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2, value_type t) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Returns the linear interpolation between two vectors using a single interpolation value. Can be used for extrapolation as well.
-
static auto lerp_unclamped(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2, const generic_ vec3_ scalar& t) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Returns the linear interpolation between two vectors using a vector of interpolation values. Can be used for extrapolation as well.
-
static auto lerp(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2, value_type t) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Returns the linear interpolation between two vectors using a single interpolation value. The interpolation value is clamped between 0 and 1.
-
static auto lerp(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2, const generic_ vec3_ scalar& t) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Returns the linear interpolation between two vectors using a vector of interpolation values. The interpolation values are clamped between 0 and 1.
-
static auto min(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Returns a vector containing the minimum x, y, z, and w components of the two vectors.
-
static auto max(const generic_
vec3_ scalar& v1, const generic_ vec3_ scalar& v2) -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Returns a vector containing the maximum x, y, z, and w components of the two vectors.
-
static auto clamp(const generic_
vec3_ scalar& v, const generic_ vec3_ scalar& min, const generic_ vec3_ scalar& max) -> MVM_INLINE_NODISCARD generic_ vec3_ 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_
vec3_ scalar noexcept - Returns a vector with all components set to the provided value.
-
static auto infinity() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with all components set to infinity.
-
static auto negative_infinity() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with all components set to negative infinity.
-
static auto nan() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with all components set to NaN.
-
static auto zero() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with all components set to zero.
-
static auto negative_one() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with all components set to negative one.
-
static auto one() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with all components set to one.
-
static auto x_axis() -> MVM_INLINE_NODISCARD generic_
vec3_ 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_
vec3_ scalar noexcept - Returns a vector with the y component set to one and all other components set to zero.
-
static auto z_axis() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with the z component set to one and all other components set to zero.
-
static auto left() -> MVM_INLINE_NODISCARD generic_
vec3_ 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_
vec3_ 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_
vec3_ 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_
vec3_ scalar noexcept - Returns a vector with the y component set to one and all other components set to zero.
-
static auto backward() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with the z component set to negative one and all other components set to zero.
-
static auto forward() -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Returns a vector with the z component set to one and all other components set to zero.
Constructors, destructors, conversion operators
-
generic_vec3_scalar(const generic_
vec3_ scalar& v) defaulted
Public functions
- auto generic_vec3_scalar() -> MVM_INLINE_NODISCARD noexcept
- Construct a new generic_
vec3_ scalar object. - auto generic_vec3_scalar(value_type x, value_type y = 0, value_type z = 0) -> MVM_INLINE_NODISCARD noexcept
- Construct a new generic_
vec3_ 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_
vec3_ scalar& v) const -> MVM_INLINE_NODISCARD bool noexcept - Determines if the vector is equal to another vector.
-
auto operator!=(const generic_
vec3_ scalar& v) const -> MVM_INLINE_NODISCARD bool noexcept - Determines if the vector is not equal to another vector.
-
auto operator<(const generic_
vec3_ 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_
vec3_ 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_
vec3_ 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_
vec3_ 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_
vec3_ scalar& v) -> MVM_ INLINE generic_ vec3_ scalar& noexcept - Assigns the contents of another vector to this vector.
-
auto operator+=(const generic_
vec3_ scalar& v) -> MVM_ INLINE generic_ vec3_ scalar& noexcept - Adds another vector to this vector and stores the result in this vector.
-
auto operator-=(const generic_
vec3_ scalar& v) -> MVM_ INLINE generic_ vec3_ scalar& noexcept - Subtracts another vector from this vector and stores the result in this vector.
-
auto operator*=(value_type v) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Multiplies this vector by a scalar and stores the result in this vector.
-
auto operator*=(const generic_
vec3_ scalar& v) -> MVM_ INLINE generic_ vec3_ scalar& noexcept - Multiplies this vector by another vector component-wise and stores the result in this vector.
-
auto operator/=(value_type v) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Divides this vector by a scalar and stores the result in this vector.
-
auto operator/=(const generic_
vec3_ scalar& v) -> MVM_ INLINE generic_ vec3_ scalar& noexcept - Divides this vector by another vector component-wise and stores the result in this vector.
-
auto operator+(const generic_
vec3_ scalar& v) const -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Adds the other vector to this vector and returns the result. Does not modify this vector.
-
auto operator-(const generic_
vec3_ scalar& v) const -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Subtracts a vector from this vector and returns the result. Does not modify this vector.
-
auto operator*(value_type v) const -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Multiplies this vector by a scalar and returns the result. Does not modify this vector.
-
auto operator*(const generic_
vec3_ scalar& v) const -> MVM_INLINE_NODISCARD generic_ vec3_ scalar noexcept - Multiplies this vector by another vector component-wise and returns the result. Does not modify this vector.
-
auto operator/(value_type v) const -> MVM_INLINE_NODISCARD generic_
vec3_ scalar noexcept - Divides this vector by a scalar and returns the result. Does not modify this vector.
-
auto operator/(const generic_
vec3_ scalar& v) const -> MVM_INLINE_NODISCARD generic_ vec3_ 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_
vec3_ 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 z() const -> MVM_INLINE_NODISCARD value_type noexcept
- Returns the z component of the vector.
-
auto x(value_type x) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Sets the x component of the vector.
-
auto y(value_type y) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Sets the y component of the vector.
-
auto z(value_type z) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Sets the z component of the vector.
-
auto set_x(value_type x) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Sets the x component of the vector.
-
auto set_y(value_type y) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Sets the y component of the vector.
-
auto set_z(value_type z) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Sets the z component of the vector.
-
auto fill(component_
type value) -> MVM_ INLINE generic_ vec3_ scalar& noexcept - Sets all components of the vector to the same value.
-
auto set(value_type x,
value_type y,
value_type z) -> MVM_
INLINE generic_ vec3_ scalar& noexcept - Sets the x, y and z 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_
vec3_ 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_vec3_scalar<value_type>:: dot(const generic_ vec3_ scalar& v1,
const generic_ vec3_ 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_vec3_scalar<value_type>:: distance_between_points(const generic_ vec3_ scalar& v1,
const generic_ vec3_ scalar& v2) noexcept
Returns the euclidean distance between two vectors as if they were points in four dimensional space.
Parameters | |
---|---|
v1 | The first vector |
v2 | The second vector |
template<typename value_type>
static MVM_INLINE_NODISCARD value_type move:: vectormath:: generic_vec3_scalar<value_type>:: squared_distance_between_points(const generic_ vec3_ scalar& v1,
const generic_ vec3_ scalar& v2) noexcept
Returns the squared euclidean distance between two vectors as if they were points in four dimensional space.
Parameters | |
---|---|
v1 | The first vector |
v2 | The second vector |
template<typename value_type>
static MVM_INLINE_NODISCARD value_type move:: vectormath:: generic_vec3_scalar<value_type>:: distance_to_line(const generic_ vec3_ scalar& point,
const generic_ vec3_ scalar& v0,
const generic_ vec3_ 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 generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: cross(const generic_ vec3_ scalar& v1,
const generic_ vec3_ scalar& v2) noexcept
Calculates the cross product of two vectors.
Parameters | |
---|---|
v1 | The first vector |
v2 | The second vector |
Returns | generic_ |
template<typename value_type>
static MVM_INLINE_NODISCARD value_type move:: vectormath:: generic_vec3_scalar<value_type>:: angle_between_normalized_vectors(const generic_ vec3_ scalar& v1,
const generic_ vec3_ 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_vec3_scalar<value_type>:: angle_between_vectors(const generic_ vec3_ scalar& v1,
const generic_ vec3_ 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_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: reflect(const generic_ vec3_ scalar& incident,
const generic_ vec3_ 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_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: refract(const generic_ vec3_ scalar& incident,
const generic_ vec3_ 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_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: lerp_unclamped(const generic_ vec3_ scalar& v1,
const generic_ vec3_ scalar& v2,
value_type t) noexcept
Returns the linear interpolation between two vectors using a single interpolation value. Can be used for extrapolation as well.
Parameters | |
---|---|
v1 | The first vector |
v2 | The second vector |
t | The interpolation value |
Returns | generic_ |
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: lerp_unclamped(const generic_ vec3_ scalar& v1,
const generic_ vec3_ scalar& v2,
const generic_ vec3_ scalar& t) noexcept
Returns the linear interpolation between two vectors using a vector of interpolation values. Can be used for extrapolation as well.
Parameters | |
---|---|
v1 | The first vector |
v2 | The second vector |
t | The interpolation values |
Returns | generic_ |
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: lerp(const generic_ vec3_ scalar& v1,
const generic_ vec3_ scalar& v2,
value_type t) noexcept
Returns the linear interpolation between two vectors using a single interpolation value. The interpolation value is clamped between 0 and 1.
Parameters | |
---|---|
v1 | The first vector |
v2 | The second vector |
t | The interpolation value |
Returns | generic_ |
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: lerp(const generic_ vec3_ scalar& v1,
const generic_ vec3_ scalar& v2,
const generic_ vec3_ scalar& t) noexcept
Returns the linear interpolation between two vectors using a vector of interpolation values. The interpolation values are clamped between 0 and 1.
Parameters | |
---|---|
v1 | The first vector |
v2 | The second vector |
t | The interpolation values |
Returns | generic_ |
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: min(const generic_ vec3_ scalar& v1,
const generic_ vec3_ 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_ |
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: max(const generic_ vec3_ scalar& v1,
const generic_ vec3_ 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_ |
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: clamp(const generic_ vec3_ scalar& v,
const generic_ vec3_ scalar& min,
const generic_ vec3_ 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_ |
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_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_ |
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: infinity() noexcept
Returns a vector with all components set to infinity.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: negative_infinity() noexcept
Returns a vector with all components set to negative infinity.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: nan() noexcept
Returns a vector with all components set to NaN.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: zero() noexcept
Returns a vector with all components set to zero.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: negative_one() noexcept
Returns a vector with all components set to negative one.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: one() noexcept
Returns a vector with all components set to one.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_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_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_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_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: z_axis() noexcept
Returns a vector with the z component set to one and all other components set to zero.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_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_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: right() noexcept
Returns a vector with the x component set to one and all other components set to zero.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_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_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: up() noexcept
Returns a vector with the y component set to one and all other components set to zero.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: backward() noexcept
Returns a vector with the z component set to negative one and all other components set to zero.
Returns | generic_ |
---|
template<typename value_type>
static MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: forward() noexcept
Returns a vector with the z component set to one and all other components set to zero.
Returns | generic_ |
---|
template<typename value_type>
MVM_INLINE_NODISCARD move:: vectormath:: generic_vec3_scalar<value_type>:: generic_vec3_scalar(value_type x,
value_type y = 0,
value_type z = 0) noexcept
Construct a new generic_
Parameters | |
---|---|
x | The x component of the vector |
y | The y component of the vector |
z | The z component of the vector |
template<typename value_type>
template<typename Archive>
MVM_ INLINE void move:: vectormath:: generic_vec3_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_vec3_scalar<value_type>:: operator==(const generic_ vec3_ 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_vec3_scalar<value_type>:: operator!=(const generic_ vec3_ 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_vec3_scalar<value_type>:: operator<(const generic_ vec3_ 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_vec3_scalar<value_type>:: operator<=(const generic_ vec3_ 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_vec3_scalar<value_type>:: operator>(const generic_ vec3_ 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_vec3_scalar<value_type>:: operator>=(const generic_ vec3_ 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_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: operator=(const generic_ vec3_ scalar& v) noexcept
Assigns the contents of another vector to this vector.
Parameters | |
---|---|
v | The other vector |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: operator+=(const generic_ vec3_ scalar& v) noexcept
Adds another vector to this vector and stores the result in this vector.
Parameters | |
---|---|
v | The other vector |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: operator-=(const generic_ vec3_ scalar& v) noexcept
Subtracts another vector from this vector and stores the result in this vector.
Parameters | |
---|---|
v | The other vector |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: operator*=(value_type v) noexcept
Multiplies this vector by a scalar and stores the result in this vector.
Parameters | |
---|---|
v | The scalar |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: operator*=(const generic_ vec3_ 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_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: operator/=(value_type v) noexcept
Divides this vector by a scalar and stores the result in this vector.
Parameters | |
---|---|
v | The scalar |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: operator/=(const generic_ vec3_ 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_ |
template<typename value_type>
MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: operator+(const generic_ vec3_ 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_ |
template<typename value_type>
MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: operator-(const generic_ vec3_ 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_ |
template<typename value_type>
MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: operator*(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_ |
template<typename value_type>
MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: operator*(const generic_ vec3_ 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_ |
template<typename value_type>
MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: operator/(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_ |
template<typename value_type>
MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: operator/(const generic_ vec3_ 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_ |
template<typename value_type>
MVM_INLINE_NODISCARD generic_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: operator-() const noexcept
Negates the vector and returns the result. Does not modify this vector.
Returns | generic_ |
---|
template<typename value_type>
MVM_INLINE_NODISCARD value_type move:: vectormath:: generic_vec3_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_vec3_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_vec3_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_vec3_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_vec3_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 value_type move:: vectormath:: generic_vec3_scalar<value_type>:: z() const noexcept
Returns the z component of the vector.
Returns | value_type The z component |
---|
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: x(value_type x) noexcept
Sets the x component of the vector.
Parameters | |
---|---|
x | The new x component |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: y(value_type y) noexcept
Sets the y component of the vector.
Parameters | |
---|---|
y | The new y component |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: z(value_type z) noexcept
Sets the z component of the vector.
Parameters | |
---|---|
z | The new z component |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: set_x(value_type x) noexcept
Sets the x component of the vector.
Parameters | |
---|---|
x | The new x component |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: set_y(value_type y) noexcept
Sets the y component of the vector.
Parameters | |
---|---|
y | The new y component |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: set_z(value_type z) noexcept
Sets the z component of the vector.
Parameters | |
---|---|
z | The new z component |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: fill(component_ type value) noexcept
Sets all components of the vector to the same value.
Parameters | |
---|---|
value | The new value for all components |
Returns | generic_ |
template<typename value_type>
MVM_ INLINE generic_ vec3_ scalar& move:: vectormath:: generic_vec3_scalar<value_type>:: set(value_type x,
value_type y,
value_type z) noexcept
Sets the x, y and z components of the vector.
Parameters | |
---|---|
x | The new x component |
y | The new y component |
z | The new z component |
Returns | generic_ |
template<typename value_type>
MVM_INLINE_NODISCARD value_type move:: vectormath:: generic_vec3_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_vec3_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_vec3_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_ vec3_ scalar move:: vectormath:: generic_vec3_scalar<value_type>:: normalized() const noexcept
Returns a normalized copy of the vector.
Returns | generic_ |
---|
template<typename value_type>
MVM_ INLINE void move:: vectormath:: generic_vec3_scalar<value_type>:: normalize() noexcept
Normalizes the vector.
Returns | generic_ |
---|