18 constexpr std::istream &
operator>>(std::istream &is, U &vec);
23 constexpr std::ostream &
operator<<(std::ostream &os, U
const &vec);
28 constexpr std::ostream &
operator<<(std::ostream &os, U &vec);
38 template <
size_t n, AnyVec Vector>
39 [[nodiscard]]
constexpr vec<n, typename Vector::type> &
as_rvec(Vector &v)
noexcept requires(n >= 2 && n <= Vector::size);
48 template <AnyVec Vector>
49 [[nodiscard]]
constexpr vec<Vector::size, typename Vector::type> &
as_rvec(Vector &v)
noexcept;
61 template <
size_t n, Primitive U, AnyVec Vector>
62 [[nodiscard]]
constexpr vec<n, U>
as_vec(Vector
const &v)
noexcept requires(n >= 2 && n <= Vector::size);
72 template <
size_t n, AnyVec Vector>
73 [[nodiscard]]
constexpr vec<n, std::remove_const_t<typename Vector::type>>
as_vec(Vector
const &v)
noexcept requires(n >= 2 && n <= Vector::size);
81 template <AnyVec Vector>
82 [[nodiscard]]
constexpr vec<Vector::size, std::remove_const_t<typename Vector::type>>
as_vec(Vector
const &v)
noexcept;
93 template <
size_t n, AnyVec Vector>
94 [[nodiscard]]
constexpr vec<n, typename Vector::type>
const &
as_crvec(Vector
const &v)
noexcept requires(n >= 2 && n <= Vector::size);
103 template <AnyVec Vector>
104 [[nodiscard]]
constexpr vec<Vector::size, typename Vector::type>
const &
as_crvec(Vector
const &v)
noexcept;
106 template <
size_t size, Primitive T, Primitive U>
107 [[nodiscard]]
constexpr vec<size, T>
operator+(vec<size, T>
const &vector, U
const value)
noexcept;
108 template <
size_t size, Primitive T, Primitive U>
109 [[nodiscard]]
constexpr vec<size, T>
operator-(vec<size, T>
const &vector, U
const value)
noexcept;
110 template <
size_t size, Primitive T, Primitive U>
111 [[nodiscard]]
constexpr vec<size, T>
operator*(vec<size, T>
const &vector, U
const value)
noexcept;
112 template <
size_t size, Primitive T, Primitive U>
113 [[nodiscard]]
constexpr vec<size, T>
operator/(vec<size, T>
const &vector, U
const value)
noexcept;
115 template <
size_t size, Primitive T, Primitive U>
116 [[nodiscard]]
constexpr vec<size, T>
operator*(U
const value, vec<size, T>
const &vector)
noexcept;
117 template <
size_t size, Primitive T, Primitive U>
118 [[nodiscard]]
constexpr vec<size, T>
operator/(U
const value, vec<size, T>
const &vector)
noexcept;
119 template <
size_t size, Primitive T, Primitive U>
120 [[nodiscard]]
constexpr vec<size, T>
operator+(U
const value, vec<size, T>
const &vector)
noexcept;
121 template <
size_t size, Primitive T, Primitive U>
122 [[nodiscard]]
constexpr vec<size, T>
operator-(U
const value, vec<size, T>
const &vector)
noexcept;
124 template <
size_t size, Primitive T, Primitive U>
125 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator*(U
const value, _detail::rvec<size, T>
const &vector)
noexcept;
126 template <
size_t size, Primitive T, Primitive U>
127 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator+(_detail::rvec<size, T>
const &vector, U
const value)
noexcept;
128 template <
size_t size, Primitive T, Primitive U>
129 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator-(_detail::rvec<size, T>
const &vector, U
const value)
noexcept;
130 template <
size_t size, Primitive T, Primitive U>
131 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator*(_detail::rvec<size, T>
const &vector, U
const value)
noexcept;
132 template <
size_t size, Primitive T, Primitive U>
133 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator/(_detail::rvec<size, T>
const &vector, U
const value)
noexcept;
134 template <
size_t size, Primitive T, Primitive U>
135 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator%(_detail::rvec<size, T>
const &left, U
const value)
noexcept;
137 template <
size_t size, Primitive T, Primitive U>
138 [[nodiscard]]
constexpr vec<size, T>
operator+(vec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
139 template <
size_t size, Primitive T, Primitive U>
140 [[nodiscard]]
constexpr vec<size, T>
operator-(vec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
141 template <
size_t size, Primitive T, Primitive U>
142 [[nodiscard]]
constexpr vec<size, T>
operator*(vec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
143 template <
size_t size, Primitive T, Primitive U>
144 [[nodiscard]]
constexpr vec<size, T>
operator/(vec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
145 template <
size_t size, Primitive T, Primitive U>
146 [[nodiscard]]
constexpr vec<size, T>
operator%(vec<size, T>
const &left, U
const value)
noexcept;
147 template <
size_t size, Primitive T, Primitive U>
148 [[nodiscard]]
constexpr vec<size, T>
operator%(vec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
150 template <
size_t size, Primitive T, Primitive U>
151 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator+(_detail::rvec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
152 template <
size_t size, Primitive T, Primitive U>
153 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator-(_detail::rvec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
154 template <
size_t size, Primitive T, Primitive U>
155 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator*(_detail::rvec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
156 template <
size_t size, Primitive T, Primitive U>
157 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator/(_detail::rvec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
158 template <
size_t size, Primitive T, Primitive U>
159 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator%(_detail::rvec<size, T>
const &left, vec<size, U>
const &right)
noexcept;
161 template <
size_t size, Primitive T, Primitive U>
162 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator+(_detail::rvec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
163 template <
size_t size, Primitive T, Primitive U>
164 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator-(_detail::rvec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
165 template <
size_t size, Primitive T, Primitive U>
166 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator*(_detail::rvec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
167 template <
size_t size, Primitive T, Primitive U>
168 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator/(_detail::rvec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
169 template <
size_t size, Primitive T, Primitive U>
170 [[nodiscard]]
constexpr vec<size, std::remove_const_t<T>>
operator%(_detail::rvec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
172 template <
size_t size, Primitive T, Primitive U>
173 [[nodiscard]]
constexpr vec<size, T>
operator+(vec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
174 template <
size_t size, Primitive T, Primitive U>
175 [[nodiscard]]
constexpr vec<size, T>
operator-(vec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
176 template <
size_t size, Primitive T, Primitive U>
177 [[nodiscard]]
constexpr vec<size, T>
operator*(vec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
178 template <
size_t size, Primitive T, Primitive U>
179 [[nodiscard]]
constexpr vec<size, T>
operator/(vec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
180 template <
size_t size, Primitive T, Primitive U>
181 [[nodiscard]]
constexpr vec<size, T>
operator%(vec<size, T>
const &left, _detail::rvec<size, U>
const &right)
noexcept;
183 template <AnyVec T, AnyVec U>
184 [[nodiscard]]
constexpr bool operator==(T
const &left, U
const &right)
noexcept requires(T::size == U::size);
186 template <AnyVec T, AnyVec U>
187 [[nodiscard]]
constexpr bool operator!=(T
const &left, U
const &right)
noexcept requires(T::size == U::size);
196 [[nodiscard]]
constexpr typename std::remove_const_t<typename T::type>
squared_length(T
const &vector)
noexcept;
205 [[nodiscard]]
constexpr auto length(T
const &vector)
noexcept;
215 [[nodiscard]]
constexpr vec<T::size, std::remove_const_t<typename T::type>>
unit_vector(T
const &vector)
noexcept;
225 [[nodiscard]]
constexpr vec<T::size, std::remove_const_t<typename T::type>>
normalize(T
const &vector)
noexcept;
237 template <AnyVec T, AnyVec U>
238 constexpr std::remove_const_t<typename T::type>
dot(T
const &left, U
const &right)
noexcept requires(T::size == U::size);
250 template <AnyVec T, AnyVec U>
251 constexpr std::remove_const_t<typename T::type>
angle(T
const &left, U
const &right)
noexcept requires(T::size == U::size);
254 constexpr vec<T::size, std::remove_const_t<typename T::type>>
cos(T
const &vector)
noexcept;
256 constexpr vec<T::size, std::remove_const_t<typename T::type>>
sin(T
const &vector)
noexcept;
258 constexpr vec<T::size, std::remove_const_t<typename T::type>>
tan(T
const &vector)
noexcept;
260 constexpr vec<T::size, std::remove_const_t<typename T::type>>
acos(T
const &vector)
noexcept;
262 constexpr vec<T::size, std::remove_const_t<typename T::type>>
asin(T
const &vector)
noexcept;
264 constexpr vec<T::size, std::remove_const_t<typename T::type>>
atan(T
const &vector)
noexcept;
265 template <AnyVec T, AnyVec U>
266 constexpr vec<T::size, std::remove_const_t<typename T::type>>
atan(T
const &left, U
const &right)
noexcept requires(T::size == U::size);
267 template <AnyVec T, AnyVec U>
268 constexpr vec<T::size, std::remove_const_t<typename T::type>>
atan2(T
const &left, U
const &right)
noexcept requires(T::size == U::size);
270 constexpr vec<T::size, std::remove_const_t<typename T::type>>
cosh(T
const &vector)
noexcept;
272 constexpr vec<T::size, std::remove_const_t<typename T::type>>
sinh(T
const &vector)
noexcept;
274 constexpr vec<T::size, std::remove_const_t<typename T::type>>
tanh(T
const &vector)
noexcept;
276 constexpr vec<T::size, std::remove_const_t<typename T::type>>
acosh(T
const &vector)
noexcept;
278 constexpr vec<T::size, std::remove_const_t<typename T::type>>
asinh(T
const &vector)
noexcept;
280 constexpr vec<T::size, std::remove_const_t<typename T::type>>
atanh(T
const &vector)
noexcept;
282 constexpr vec<T::size, std::remove_const_t<typename T::type>>
exp(T
const &vector)
noexcept;
284 constexpr vec<T::size, std::remove_const_t<typename T::type>>
exp2(T
const &vector)
noexcept;
286 constexpr vec<T::size, std::remove_const_t<typename T::type>>
expm1(T
const &vector)
noexcept;
288 constexpr vec<T::size, std::remove_const_t<typename T::type>>
log(T
const &vector)
noexcept;
290 constexpr vec<T::size, std::remove_const_t<typename T::type>>
log2(T
const &vector)
noexcept;
292 constexpr vec<T::size, std::remove_const_t<typename T::type>>
log10(T
const &vector)
noexcept;
294 constexpr vec<T::size, std::remove_const_t<typename T::type>>
log1p(T
const &vector)
noexcept;
296 constexpr vec<T::size, std::remove_const_t<typename T::type>>
logb(T
const &vector)
noexcept;
298 constexpr vec<T::size, std::remove_const_t<typename T::type>>
sqrt(T
const &vector)
noexcept;
300 constexpr vec<T::size, std::remove_const_t<typename T::type>>
inversesqrt(T
const &vector)
noexcept;
303 constexpr vec<T::size, std::remove_const_t<typename T::type>>
abs(T
const &vector)
noexcept;
305 constexpr vec<T::size, std::remove_const_t<typename T::type>>
sign(T
const &vector)
noexcept;
307 constexpr vec<T::size, std::remove_const_t<typename T::type>>
floor(T
const &vector)
noexcept;
309 constexpr vec<T::size, std::remove_const_t<typename T::type>>
ceil(T
const &vector)
noexcept;
311 constexpr vec<T::size, std::remove_const_t<typename T::type>>
trunc(T
const &vector)
noexcept;
313 constexpr vec<T::size, std::remove_const_t<typename T::type>>
round(T
const &vector)
noexcept;
315 constexpr vec<T::size, std::remove_const_t<typename T::type>>
roundEven(T
const &vector)
noexcept;
317 constexpr vec<T::size, std::remove_const_t<typename T::type>>
fract(T
const &vector)
noexcept;
319 constexpr vec<T::size, std::remove_const_t<typename T::type>>
mod(T
const &vector,
typename T::type
const &scalar)
noexcept;
320 template <AnyVec T, AnyVec U>
321 constexpr vec<T::size, std::remove_const_t<typename T::type>>
mod(T
const &left, U
const &right)
noexcept requires(T::size == U::size);
323 template <AnyVec T, Primitive U>
324 constexpr vec<T::size, std::remove_const_t<typename T::type>>
pow(T
const &vector, U
const pow)
noexcept;
326 template <AnyVec T, AnyVec U>
327 constexpr vec<T::size, std::remove_const_t<typename T::type>>
pow(T
const &vector1, U
const &vector2)
noexcept;
338 template <AnyVec T, AnyVec U>
339 constexpr vec<3, std::remove_const_t<typename T::type>>
cross(T
const &left, U
const &right)
noexcept requires(T::size == U::size && T::size == 3);
350 template <Primitive T, Primitive U>
351 constexpr void rclamp(T &left, U
const min, U
const max)
noexcept;
362 template <AnyVec T, AnyVec U>
363 constexpr void rclamp(T &left, U
const min, U
const max)
noexcept requires(T::size == U::size);
375 template <AnyVec T, Primitive U>
376 [[nodiscard]]
constexpr vec<T::size, std::remove_const_t<typename T::type>>
clamp(T
const &left, U
const min, U
const max)
noexcept;
388 template <AnyVec T, AnyVec U>
389 [[nodiscard]]
constexpr vec<T::size, std::remove_const_t<typename T::type>>
clamp(T
const &left, U
const &
min, U
const &
max)
noexcept requires(T::size == U::size);
401 template <Primitive T, Primitive U>
402 [[nodiscard]]
constexpr T
clamp(T left, U
const min, U
const max)
noexcept;
412 template <AnyVec T, Primitive U>
413 [[nodiscard]]
constexpr vec<T::size, std::remove_const_t<typename T::type>>
min(T
const &left, U
const min)
noexcept;
423 template <AnyVec T, Primitive U>
424 [[nodiscard]]
constexpr vec<T::size, std::remove_const_t<typename T::type>>
max(T
const &left, U
const max)
noexcept;
435 template <AnyVec T, AnyVec U>
436 [[nodiscard]]
constexpr vec<T::size, std::remove_const_t<typename T::type>>
min(T
const &left, U
const &
min)
noexcept requires(T::size == U::size);
447 template <AnyVec T, AnyVec U>
448 [[nodiscard]]
constexpr vec<T::size, std::remove_const_t<typename T::type>>
max(T
const &left, U
const &
max)
noexcept requires(T::size == U::size);
458 template <AnyVec T, AnyVec U>
459 constexpr void rmin(T &left, U
const &
max)
noexcept requires(T::size == U::size);
469 template <AnyVec T, AnyVec U>
470 constexpr void rmax(T &left, U
const &
min)
noexcept requires(T::size == U::size);
480 template <AnyVec T, Primitive U>
481 constexpr void rmin(T &left, U
const max)
noexcept;
491 template <AnyVec T, Primitive U>
492 constexpr void rmax(T &left, U
const min)
noexcept;
502 template <Primitive T, Primitive U>
503 constexpr void rmin(T &left, U
const max)
noexcept;
513 template <Primitive T, Primitive U>
514 constexpr void rmax(T &left, U
const min)
noexcept;
524 [[nodiscard]]
constexpr std::remove_const_t<typename T::type>
distance(T
const &left, T
const &right)
noexcept;
535 template <
typename T, Primitive U>
536 [[nodiscard]]
constexpr auto lerp(T
const &from, T
const &to, U
const param)
noexcept;
548 template <
typename T, Primitive U>
549 [[nodiscard]]
constexpr auto mix(T
const &from, T
const &to, U
const param)
noexcept;
Contains mathematical utility functions and classes.
constexpr auto lerp(T const &from, T const &to, U const param) noexcept
Linearly interpolate between two values.
float atanh(T x) noexcept
constexpr vec< T::size, std::remove_const_t< typename T::type > > max(T const &left, U const max) noexcept
Returns a new vector with each element being the maximum of the corresponding element in left and min...
float atan2(T x, T y) noexcept
float log1p(T x) noexcept
float acosh(T x) noexcept
constexpr T length(qua< T > const &q) noexcept
Computes the length (or magnitude) of a quaternion.
float expm1(T x) noexcept
float log10(T x) noexcept
constexpr void rmin(T &left, U const &max) noexcept
Modifies left in-place, setting each element to the minimum of itself and the corresponding element i...
constexpr vec< n, typename Vector::type > const & as_crvec(Vector const &v) noexcept
Convert a given const vector to a const reference of vec with specified size and type.
float mod(T x, U y) noexcept
constexpr T clamp(T x, T min, T max) noexcept
Function to clamp a value between a minimum and maximum.
constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > operator-(T const &left, U const right)
Subtracts a matrix from a primitive.
constexpr T angle(qua< T > const &quaternion) noexcept
Computes the angle (or magnitude) of a quaternion.
T roundEven(T x) noexcept
float inversesqrt(T x) noexcept
constexpr auto operator*(U const &lhs, V const &rhs)
Multiplies two matrices.
constexpr std::remove_const_t< typename T::type > distance(T const &left, T const &right) noexcept
Compute the distance between two vectors.
constexpr bool operator==(T const &left, U const &right) noexcept
constexpr vec< n, U > as_vec(Vector const &v) noexcept
Create a new vector of a specified size and type from the given vector.
constexpr std::remove_const_t< typename T::type > squared_length(T const &vector) noexcept
Compute the squared length of the given vector.
constexpr std::istream & operator>>(std::istream &is, U &matrix)
Reads a matrix from an input stream.
constexpr std::ostream & operator<<(std::ostream &os, U const &matrix)
Writes a matrix to an output stream.
constexpr void rclamp(T &left, U const min, U const max) noexcept
Clamp the value of left between min and max in-place.
float asinh(T x) noexcept
constexpr T dot(qua< T > const &left, qua< U > const &right) noexcept
Computes the dot product of two quaternions.
constexpr void rmax(T &left, U const &min) noexcept
Modifies left in-place, setting each element to the maximum of itself and the corresponding element i...
float pow(T x, U y) noexcept
constexpr bool operator!=(T const &left, U const &right) noexcept
constexpr qua< T > normalize(qua< T > const &q) noexcept
Normalizes a quaternion.
constexpr vec< T::size, std::remove_const_t< typename T::type > > unit_vector(T const &vector) noexcept
Compute the unit vector (normalized vector) of the given vector.
constexpr mat< T::size.x, T::size.y, std::remove_const_t< typename T::type > > operator+(U const left, T const &right)
Adds a matrix to a primitive.
constexpr vec< n, typename Vector::type > & as_rvec(Vector &v) noexcept
Convert a given vector to a reference of vec with specified size and type.
constexpr auto mix(T const &from, T const &to, U const param) noexcept
Mix between two values (same as lerp).
constexpr vec< size, std::remove_const_t< T > > operator%(_detail::rvec< size, T > const &left, U const value) noexcept
constexpr vec< T::size, std::remove_const_t< typename T::type > > min(T const &left, U const min) noexcept
Returns a new vector with each element being the minimum of the corresponding element in left and max...
constexpr qua< T > operator/(U const value, qua< T > const &vector) noexcept
Scalar-quaternion division.
constexpr vec< 3, T > cross(qua< T > const &left, vec< 3, U > const &right) noexcept
Cross product between quaternion and vector.