[nnm] No Nonsense Math 0.5.0
A No-Nonsense, C++ 17, single-header-only Math library geared towards graphics programming.
|
#include <nnm.hpp>
Classes | |
struct | Hash |
Public Member Functions | |
constexpr | Vector2i () |
template<typename Real> | |
constexpr | Vector2i (const Vector2< Real > &vector) |
constexpr | Vector2i (const Int x, const Int y) |
constexpr Vector2i | abs () const |
constexpr Vector2i | clamp (const Vector2i &min, const Vector2i &max) const |
constexpr Int | manhattan_distance (const Vector2i &to) const |
constexpr Int | length_sqrd () const |
constexpr Int | dot (const Vector2i &other) const |
constexpr Int | cross (const Vector2i &other) const |
constexpr bool | parallel (const Vector2i &other) const |
constexpr bool | perpendicular (const Vector2i &other) const |
constexpr Vector2i | arbitrary_perpendicular () const |
constexpr Int | max () const |
constexpr Int | abs_max () const |
constexpr Int | min () const |
constexpr Int | abs_min () const |
constexpr uint8_t | max_index () const |
constexpr uint8_t | abs_max_index () const |
constexpr uint8_t | min_index () const |
constexpr uint8_t | abs_min_index () const |
const Int * | begin () const |
const Int * | end () const |
Int * | begin () |
Int * | end () |
constexpr const Int & | at (const uint8_t index) const |
constexpr Int & | at (const uint8_t index) |
constexpr const Int & | operator[] (const uint8_t index) const |
constexpr Int & | operator[] (const uint8_t index) |
constexpr bool | operator== (const Vector2i &other) const |
constexpr bool | operator!= (const Vector2i &other) const |
constexpr Vector2i | operator+ (const Vector2i &other) const |
constexpr Vector2i & | operator+= (const Vector2i &other) |
constexpr Vector2i | operator- (const Vector2i &other) const |
constexpr Vector2i & | operator-= (const Vector2i &other) |
constexpr Vector2i | operator* (const Vector2i &other) const |
constexpr Vector2i & | operator*= (const Vector2i &other) |
constexpr Vector2i | operator* (const Int value) const |
constexpr Vector2i & | operator*= (const Int value) |
constexpr Vector2i | operator/ (const Vector2i &other) const |
constexpr Vector2i & | operator/= (const Vector2i &other) |
constexpr Vector2i | operator/ (const Int value) const |
constexpr Vector2i & | operator/= (const Int value) |
constexpr Vector2i | operator% (const Vector2i &other) const |
constexpr Vector2i & | operator%= (const Vector2i &other) |
constexpr Vector2i | operator% (const Int value) const |
constexpr Vector2i & | operator%= (const Int value) |
constexpr Vector2i | operator+ () const |
constexpr Vector2i | operator- () const |
constexpr bool | operator< (const Vector2i &other) const |
constexpr | operator bool () const |
Static Public Member Functions | |
static constexpr Vector2i | all (Int value) |
static constexpr Vector2i | zero () |
static constexpr Vector2i | one () |
static constexpr Vector2i | axis_x () |
static constexpr Vector2i | axis_y () |
Public Attributes | |
Int | x |
Int | y |
2-dimensional vector with integer components.
Int | Integer value. |
|
inlineconstexpr |
Initializes all components to zero.
|
inlineexplicitconstexpr |
Casts one integer vector into another
Real | Integer type. |
vector | Vector to cast from. |
|
inlineconstexpr |
Initialize with specific components.
x | X value. |
y | Y value. |
|
inlinenodiscardconstexpr |
Component-wise absolute value.
|
inlinenodiscardconstexpr |
Absolute-value maximum component.
|
inlinenodiscardconstexpr |
Index of the absolute-value maximum component.
|
inlinenodiscardconstexpr |
Absolute-value minimum component.
|
inlinenodiscardconstexpr |
Index of the absolute-value minimum component.
|
inlinestaticconstexpr |
Vector with all components to a value.
value | Value to initialize all components with. |
|
inlinenodiscardconstexpr |
Returns a vector that is perpendicular to this vector. There are multiple possible perpendicular vectors so an arbitrary perpendicular vector is returned and no assumptions should be made on which solution is returned.
|
inlineconstexpr |
Reference to component at index.
index | Index. |
|
inlinenodiscardconstexpr |
Constant reference to component at index.
index | Index. |
|
inlinestaticconstexpr |
Normalized vector that points in the direction of the positive x-axis.
|
inlinestaticconstexpr |
Normalized vector that points in the direction of the positive y-axis.
|
inline |
Start iterator.
|
inlinenodiscard |
Start constant iterator.
|
inlinenodiscardconstexpr |
Component-wise clamp.
min | Minimum. |
max | Maximum. |
|
inlinenodiscardconstexpr |
Vector cross product
other | Other vector. |
|
inlinenodiscardconstexpr |
Vector dot product.
other | Other vector. |
|
inline |
End iterator.
|
inlinenodiscard |
End constant iterator.
|
inlinenodiscardconstexpr |
Squared length of the vector.
|
inlinenodiscardconstexpr |
Distance between the position of this vector to another vector along the grid defined by the x and y axes.
to | Position to. |
|
inlinenodiscardconstexpr |
Maximum component
|
inlinenodiscardconstexpr |
Index of the maximum component.
|
inlinenodiscardconstexpr |
Minimum component.
|
inlinenodiscardconstexpr |
Index of the minimum component.
|
inlinestaticconstexpr |
Vector with all components to one.
|
inlineexplicitnodiscardconstexpr |
Evaluates to false if all components are zero, true otherwise.
|
inlinenodiscardconstexpr |
Component-wise inequality.
other | Other vector. |
|
inlinenodiscardconstexpr |
Component-wise remainder with value.
value | Value. |
|
inlinenodiscardconstexpr |
Component-wise remainder.
other | Other vector. |
|
inlineconstexpr |
Component-wise remainder with value.
value | Value. |
|
inlineconstexpr |
Component-wise remainder.
other | Other vector. |
|
inlinenodiscardconstexpr |
Component-wise multiplication with value.
value | Value. |
|
inlinenodiscardconstexpr |
Component-wise multiplication.
other | Other vector. |
|
inlineconstexpr |
Component-wise multiplication with value.
value | Value. |
|
inlineconstexpr |
Component-wise multiplication.
other | Other vector. |
|
inlinenodiscardconstexpr |
Unary plus. Does nothing but specified for symmetry with unary minus.
|
inlinenodiscardconstexpr |
Component-wise addition.
other | Other vector. |
|
inlineconstexpr |
Component-wise addition.
other | Other vector. |
|
inlinenodiscardconstexpr |
Component-wise negation.
|
inlinenodiscardconstexpr |
Component-wise subtraction.
other | Other vector. |
|
inlineconstexpr |
Component-wise subtraction.
other | Other vector. |
|
inlinenodiscardconstexpr |
Component-wise division with value.
value | Value. |
|
inlinenodiscardconstexpr |
Component-wise division.
other | Other vector. |
|
inlineconstexpr |
Component-wise division with value.
value | Value. |
|
inlineconstexpr |
Component-wise division.
other | Other vector. |
|
inlinenodiscardconstexpr |
Lexicographical comparison between components.
other | Other vector. |
|
inlinenodiscardconstexpr |
Component-wise equality.
other | Other vector. |
|
inlineconstexpr |
Reference to component at index.
index | Index. |
|
inlinenodiscardconstexpr |
Constant reference to component at index.
index | Index. |
|
inlinenodiscardconstexpr |
Determines if parallel to another vector.
other | Other vector. |
|
inlinenodiscardconstexpr |
Determines if perpendicular to another vector.
other | Other vector. |
|
inlinestaticconstexpr |
Vector with all components to zero.
Int nnm::Vector2i< Int >::x |
Int nnm::Vector2i< Int >::y |