![]() |
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 ()=default | |
| vecN (CType other) noexcept | |
| template<typename T> | |
| T | to () const noexcept |
| CppType & | deref (const auto *raw) 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 | |
| auto | 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.
|
default |
Default constructor, does nothing.
|
inlinenoexcept |
|
inlinestaticnoexcept |
Conversion operator for going from a layout-compatible vector type to a SH4ZAM vector type.
Definition at line 58 of file shz_vector.hpp.
|
inlinenoexcept |
Conversion operator for going from a SH4ZAM vector type to another layout-compatible type.
Definition at line 64 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 69 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 74 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 80 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 86 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 92 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 171 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the absolute value of the given vector.
Definition at line 176 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the negative values of the given vector.
Definition at line 181 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose components are the reciprocal values of the given vector.
Definition at line 186 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the maximum value of every element within the vector.
Definition at line 191 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the minimum value of every element within the vector.
Definition at line 196 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector whose values are the clamped components of the given vector.
Definition at line 201 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise floor of the given vector.
Definition at line 206 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise ceil of the given vector.
Definition at line 211 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise rounding of the given vector.
Definition at line 216 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the fractional part of each component.
Definition at line 221 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the sign of each component (-1, 0, or 1).
Definition at line 226 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with each component clamped to [0, 1].
Definition at line 231 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise minimum of two vectors.
Definition at line 236 of file shz_vector.hpp.
|
inlinenoexcept |
Returns a new vector with the component-wise maximum of two vectors.
Definition at line 241 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the dot product of the given vector and another.
Definition at line 246 of file shz_vector.hpp.
|
noexcept |
Returns the dot product of the given vector against two others.
Definition at line 610 of file shz_vector.hpp.
|
noexcept |
Returns the dot product of the given vector against three others.
Definition at line 615 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the magnitude of the given vector.
Definition at line 257 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the squared magnitude of the given vector.
Definition at line 262 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the inverse magnitude of the given vector.
Definition at line 267 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the direction vector resulting from normalizing the given vector.
Definition at line 272 of file shz_vector.hpp.
|
inlinenoexcept |
|
inlinenoexcept |
Returns the direction vector of a given vector, safely protecting against division-by-zero.
Definition at line 282 of file shz_vector.hpp.
|
inlinenoexcept |
Normalizes the given vector, safely protecting against division-by-zero.
Definition at line 287 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the magnitude of the difference between two vectors as their distance.
Definition at line 292 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the value of the distance between two vectors squared (faster than actual distance)
Definition at line 297 of file shz_vector.hpp.
|
inlinenoexcept |
Moves the given vector towards the target by the given maxdist.
Definition at line 302 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the vector created from reflecting the given vector over the normal of a surface.
Definition at line 307 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 312 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the vector created from projecting the given vector onto another.
Definition at line 317 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 322 of file shz_vector.hpp.
|
inlinenoexcept |
Returns the angle between the given vector and another, in radians.
Definition at line 327 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 332 of file shz_vector.hpp.
Overloaded equality operator, for comparing vectors.
Definition at line 124 of file shz_vector.hpp.
Overloaded unary negation operator, returns the negated vector.
Definition at line 129 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.