![]() |
SH4ZAM! 0.7.0
Fast math library for the Sega Dreamcast's SH4 CPU
|
#include <shz_vector.hpp>


Public Types | |
| using | CppType |
| using | CType |
Public Member Functions | |
| vecN () noexcept=default | |
| vecN (const vecN &other) noexcept=default | |
| vecN (const CType &other) noexcept | |
| vecN (const volatile CType &other) noexcept | |
| template<typename T> | |
| T | to () const noexcept |
| CppType & | deref (const auto *raw) noexcept |
| CppType & | operator+= (const CppType &other) noexcept |
| CppType & | operator-= (const CppType &other) noexcept |
| CppType & | operator*= (const CppType &other) noexcept |
| CppType & | operator/= (const CppType &other) noexcept |
| CppType & | operator*= (float other) noexcept |
| CppType & | operator/= (float other) noexcept |
| template<unsigned... Indices> | |
| CppType | swizzle () const noexcept |
| CppType | abs () const noexcept |
| CppType | neg () const noexcept |
| CppType | inv () const noexcept |
| float | max () const noexcept |
| float | min () const noexcept |
| CppType | clamp (float min, float max) const noexcept |
| CppType | floor () const noexcept |
| CppType | ceil () const noexcept |
| CppType | round () const noexcept |
| CppType | fract () const noexcept |
| CppType | sign () const noexcept |
| CppType | saturate () const noexcept |
| CppType | minv (const CppType &other) const noexcept |
| CppType | maxv (const CppType &other) const noexcept |
| float | dot (const CppType &other) const noexcept |
| vec2 | dot (const CppType &v1, const CppType &v2) const noexcept |
| vec3 | dot (const CppType &v1, const CppType &v2, const CppType &v3) const noexcept |
| float | magnitude () const noexcept |
| float | magnitude_sqr () const noexcept |
| float | magnitude_inv () const noexcept |
| CppType | direction () const noexcept |
| CppType | direction_safe () const noexcept |
| void | normalize () noexcept |
| void | normalize_safe () noexcept |
| CppType | normalized () const noexcept |
| CppType | normalized_safe () const noexcept |
| float | distance (const CppType &other) const noexcept |
| float | distance_sqr (const CppType &other) const noexcept |
| CppType | move (const CppType &target, float maxdist) const noexcept |
| CppType | reflect (const CppType &normal) const noexcept |
| CppType | refract (const CppType &normal, float eta) const noexcept |
| CppType | project (const CppType &onto) const noexcept |
| CppType | project_safe (const CppType &onto) const noexcept |
| float | angle_between (const CppType &other) const noexcept |
| auto | angles () const noexcept |
Static Public Member Functions | |
| static CppType | from (const auto &raw) noexcept |
| static CppType | lerp (const CppType &start, const CppType &end, float t) noexcept |
| template<typename T> | |
| static CppType | step (const CppType &vec, T &&edge) noexcept |
| template<typename T> | |
| static CppType | smoothstep (const CppType &vec, T &&edge0, T &&edge1) noexcept |
| template<typename T> | |
| static CppType | smoothstep_safe (const CppType &vec, T &&edge0, T &&edge1) noexcept |
Static Public Attributes | |
| static constexpr size_t | Rows |
| static constexpr size_t | Cols |
Friends | |
| bool | operator== (const CppType &lhs, const CppType &rhs) noexcept |
| CppType | operator- (const CppType &vec) noexcept |
Common C++ base structure inherited by all vector types.
This struct template serves as the base class for all concrete vector types, providing:
Definition at line 43 of file shz_vector.hpp.
| using shz::vecN< CRTP, C, R >::CppType |
Cpp derived type.
Definition at line 44 of file shz_vector.hpp.
| using shz::vecN< CRTP, C, R >::CType |
C base type.
Definition at line 45 of file shz_vector.hpp.
|
defaultnoexcept |
Default constructor, does nothing.
|
defaultnoexcept |
Default copy constructor.
|
inlinenoexcept |
|
inlinenoexcept |
Converting constructor from existing volatile C instance.
Definition at line 61 of file shz_vector.hpp.
|
inlinestaticnoexcept |
Conversion operator for going from a layout-compatible vector type to a SH4ZAM vector type.
Definition at line 65 of file shz_vector.hpp.
|
inlinenoexcept |
Conversion operator for going from a SH4ZAM vector type to another layout-compatible type.
Definition at line 71 of file shz_vector.hpp.
|
inlinenoexcept |
Conversion operator for accessing an existing pointer type as though it were a refrence to a SH4ZAM type.
Definition at line 76 of file shz_vector.hpp.
|
inlinestaticnoexcept |
Returns the vector that is linearly interpolated between the two given vectors by the 0.0f-1.0f factor, t.
Definition at line 81 of file shz_vector.hpp.
|
inlinestaticnoexcept |
Compares each component of the vector to the edge. 0 returned in that component if x[i] < edge. Otherwise the component is 1.
Definition at line 87 of file shz_vector.hpp.
|
inlinestaticnoexcept |
Returns a vector where each component is smoothly interpolated from 0 to 1 between edge0 and edge1.
Definition at line 93 of file shz_vector.hpp.
|
inlinestaticnoexcept |
Returns a vector where each component is smoothly interpolated from 0 to 1 between edge0 and edge1.
Definition at line 99 of file shz_vector.hpp.
|
inlinenoexcept |
Swizzle oeprator which takes a compile-time list of indices as non-type template arguments for the index each element should use as its new value.
Definition at line 180 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the absolute value of the given vector.
Definition at line 185 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the negative values of the given vector.
Definition at line 190 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the reciprocal values of the given vector.
Definition at line 195 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the maximum value of every element within the vector.
Definition at line 200 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the minimum value of every element within the vector.
Definition at line 205 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose values are the clamped components of the given vector.
Definition at line 210 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise floor of the given vector.
Definition at line 215 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise ceil of the given vector.
Definition at line 220 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise rounding of the given vector.
Definition at line 225 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the fractional part of each component.
Definition at line 230 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the sign of each component (-1, 0, or 1).
Definition at line 235 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with each component clamped to [0, 1].
Definition at line 240 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise minimum of two vectors.
Definition at line 245 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise maximum of two vectors.
Definition at line 250 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the dot product of the given vector and another.
Definition at line 255 of file shz_vector.hpp.
|
noexcept |
Returns the dot product of the given vector against two others.
Definition at line 638 of file shz_vector.hpp.
|
noexcept |
Returns the dot product of the given vector against three others.
Definition at line 643 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the magnitude of the given vector.
Definition at line 266 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the squared magnitude of the given vector.
Definition at line 271 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the inverse magnitude of the given vector.
Definition at line 276 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the direction vector resulting from normalizing the given vector.
Definition at line 281 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the direction vector of a given vector, safely protecting against division-by-zero.
Definition at line 286 of file shz_vector.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
Normalizes the given vector, safely protecting against division-by-zero.
Definition at line 296 of file shz_vector.hpp.
|
inlinenoexcept |
Return the normalized vector.
Definition at line 301 of file shz_vector.hpp.
|
inlinenoexcept |
Return the normalized vector, safely protecting against division-by-zero.
Definition at line 306 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the magnitude of the difference between two vectors as their distance.
Definition at line 311 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the value of the distance between two vectors squared (faster than actual distance)
Definition at line 316 of file shz_vector.hpp.
|
inlinenoexcept |
Moves the given vector towards the target by the given maxdist.
Definition at line 321 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the vector created from reflecting the given vector over the normal of a surface.
Definition at line 326 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the vector create from refracting the given incidence vector over the normal of a surface, using the given refraction ratio index.
Definition at line 331 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the vector created from projecting the given vector onto another.
Definition at line 336 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the vector created from projecting the given vector onto another, safely protecting against division-by-zero.
Definition at line 341 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the angle between the given vector and another, in radians.
Definition at line 346 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the angle(s) created between the given vector axis and the +X axis, in radians.
Definition at line 351 of file shz_vector.hpp.
|
friend |
Overloaded equality operator, for comparing vectors.
Definition at line 133 of file shz_vector.hpp.
Overloaded unary negation operator, returns the negated vector.
Definition at line 138 of file shz_vector.hpp.
|
staticconstexpr |
Number of rows.
Definition at line 47 of file shz_vector.hpp.
|
staticconstexpr |
Number of columns.
Definition at line 48 of file shz_vector.hpp.