![]() |
SH4ZAM! 0.1.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 |
| volatile CppType & | operator= (volatile CType other) volatile noexcept |
| CppType & | operator+= (CppType other) noexcept |
| CppType & | operator-= (CppType other) noexcept |
| CppType & | operator*= (CppType other) noexcept |
| CppType & | operator/= (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 (CppType other) const noexcept |
| CppType | maxv (CppType other) const noexcept |
| float | dot (CppType other) const noexcept |
| vec2 | dot (CppType v1, CppType v2) const noexcept |
| vec3 | dot (CppType v1, CppType v2, CppType v3) const noexcept |
| float | magnitude () const noexcept |
| float | magnitude_sqr () const noexcept |
| float | magnitude_inv () const noexcept |
| CppType | direction () const noexcept |
| void | normalize () noexcept |
| CppType | direction_safe () const noexcept |
| void | normalize_safe () noexcept |
| float | distance (const CppType &other) const noexcept |
| float | distance_sqr (const CppType &other) const noexcept |
| CppType | move (CppType target, float maxdist) const noexcept |
| CppType | reflect (CppType normal) const noexcept |
| CppType | refract (CppType normal, float eta) const noexcept |
| CppType | project (CppType onto) const noexcept |
| CppType | project_safe (CppType onto) const noexcept |
| float | angle_between (CppType other) const noexcept |
| auto | angles () const noexcept |
Static Public Member Functions | |
| static CppType | from (const auto &raw) noexcept |
| static CppType | lerp (CppType start, CppType end, float t) noexcept |
| template<typename T> | |
| static CppType | step (CppType vec, T edge) noexcept |
| template<typename T> | |
| static CppType | smoothstep (CppType vec, T edge0, T edge1) noexcept |
| template<typename T> | |
| static CppType | smoothstep_safe (CppType vec, T edge0, T edge1) noexcept |
Static Public Attributes | |
| static constexpr size_t | Rows |
| static constexpr size_t | Cols |
Friends | |
| bool | operator== (CppType lhs, CppType rhs) noexcept |
| CppType | operator- (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 |
Overloaded operator for assigning to volatile reference to base C type.
Definition at line 141 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 184 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the absolute value of the given vector.
Definition at line 189 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the negative values of the given vector.
Definition at line 194 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the reciprocal values of the given vector.
Definition at line 199 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the maximum value of every element within the vector.
Definition at line 204 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the minimum value of every element within the vector.
Definition at line 209 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose values are the clamped components of the given vector.
Definition at line 214 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise floor of the given vector.
Definition at line 219 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise ceil of the given vector.
Definition at line 224 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise rounding of the given vector.
Definition at line 229 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the fractional part of each component.
Definition at line 234 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the sign of each component (-1, 0, or 1).
Definition at line 239 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with each component clamped to [0, 1].
Definition at line 244 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise minimum of two vectors.
Definition at line 249 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise maximum of two vectors.
Definition at line 254 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the dot product of the given vector and another.
Definition at line 259 of file shz_vector.hpp.
|
noexcept |
Returns the dot product of the given vector against two others.
Definition at line 626 of file shz_vector.hpp.
|
noexcept |
Returns the dot product of the given vector against three others.
Definition at line 631 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the magnitude of the given vector.
Definition at line 270 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the squared magnitude of the given vector.
Definition at line 275 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the inverse magnitude of the given vector.
Definition at line 280 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the direction vector resulting from normalizing the given vector.
Definition at line 285 of file shz_vector.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
Returns the direction vector of a given vector, safely protecting against division-by-zero.
Definition at line 295 of file shz_vector.hpp.
|
inlinenoexcept |
Normalizes the given vector, safely protecting against division-by-zero.
Definition at line 300 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the magnitude of the difference between two vectors as their distance.
Definition at line 305 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the value of the distance between two vectors squared (faster than actual distance)
Definition at line 310 of file shz_vector.hpp.
|
inlinenoexcept |
Moves the given vector towards the target by the given maxdist.
Definition at line 315 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the vector created from reflecting the given vector over the normal of a surface.
Definition at line 320 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 325 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the vector created from projecting the given vector onto another.
Definition at line 330 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 335 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the angle between the given vector and another, in radians.
Definition at line 340 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 345 of file shz_vector.hpp.
Overloaded equality operator, for comparing vectors.
Definition at line 131 of file shz_vector.hpp.
Overloaded unary negation operator, returns the negated vector.
Definition at line 136 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.