MeshLib Documentation
Loading...
Searching...
No Matches
MR::Vector2< T > Struct Template Reference

#include <MRVector2.h>

Public Types

using ValueType = T
 
using MatrixType = Matrix2<T>
 
using SymMatrixType = SymMatrix2<T>
 

Public Member Functions

constexpr Vector2 () noexcept
 
 Vector2 (NoInit) noexcept
 
constexpr Vector2 (T x, T y) noexcept
 
constexpr Vector2 (const Vector3< T > &v) noexcept
 
template<typename U >
constexpr Vector2 (const Vector2< U > &v) noexcept
 
constexpr const T & operator[] (int e) const noexcept
 
constexpr T & operator[] (int e) noexcept
 
lengthSq () const
 
auto length () const
 
Vector2 normalized () const MR_REQUIRES_IF_SUPPORTED(!std
 
Vector2 operator- () const
 
const Vector2operator+ () const
 
Vector2 furthestBasisVector() const MR_REQUIRES_IF_SUPPORTED(!std Vector2 perpendicular () const MR_REQUIRES_IF_SUPPORTED(!std
 returns one of 2 basis unit vector that makes the biggest angle with the direction specified by this
 
Vector2operator+= (const Vector2< T > &b)
 
Vector2operator-= (const Vector2< T > &b)
 
Vector2operator*= (T b)
 
Vector2operator/= (T b)
 
bool isFinite () const MR_REQUIRES_IF_SUPPORTED(std
 

Static Public Member Functions

static constexpr Vector2 diagonal (T a) noexcept
 
static constexpr Vector2 plusX () noexcept
 
static constexpr Vector2 plusY () noexcept
 
static constexpr Vector2 minusX () noexcept
 
static constexpr Vector2 minusY () noexcept
 

Public Attributes

x
 
y
 

Static Public Attributes

static constexpr int elements = 2
 

Related Symbols

(Note that these are not member symbols.)

template<typename T >
cross (const Vector2< T > &a, const Vector2< T > &b)
 cross product
 
template<typename T >
dot (const Vector2< T > &a, const Vector2< T > &b)
 dot product
 
template<typename T >
sqr (const Vector2< T > &a)
 squared length
 
template<typename T >
Vector2< T > mult (const Vector2< T > &a, const Vector2< T > &b)
 per component multiplication
 
template<typename T >
Vector2< T > div (const Vector2< T > &a, const Vector2< T > &b)
 per component division
 
template<typename T >
angle (const Vector2< T > &a, const Vector2< T > &b)
 angle in radians between two vectors
 

Detailed Description

template<typename T>
struct MR::Vector2< T >

two-dimensional vector

Member Typedef Documentation

◆ MatrixType

template<typename T >
using MR::Vector2< T >::MatrixType = Matrix2<T>

◆ SymMatrixType

template<typename T >
using MR::Vector2< T >::SymMatrixType = SymMatrix2<T>

◆ ValueType

template<typename T >
using MR::Vector2< T >::ValueType = T

Constructor & Destructor Documentation

◆ Vector2() [1/5]

template<typename T >
MR::Vector2< T >::Vector2 ( )
inlineconstexprnoexcept

◆ Vector2() [2/5]

template<typename T >
MR::Vector2< T >::Vector2 ( NoInit )
inlineexplicitnoexcept

◆ Vector2() [3/5]

template<typename T >
MR::Vector2< T >::Vector2 ( T x,
T y )
inlineconstexprnoexcept

◆ Vector2() [4/5]

template<typename T >
MR::Vector2< T >::Vector2 ( const Vector3< T > & v)
inlineexplicitconstexprnoexcept

◆ Vector2() [5/5]

template<typename T >
template<typename U >
MR::Vector2< T >::Vector2 ( const Vector2< U > & v)
inlineexplicitconstexprnoexcept

Member Function Documentation

◆ diagonal()

template<typename T >
static constexpr Vector2 MR::Vector2< T >::diagonal ( T a)
inlinestaticconstexprnoexcept

◆ isFinite()

template<typename T >
bool MR::Vector2< T >::isFinite ( ) const
inlinenodiscard

◆ length()

template<typename T >
auto MR::Vector2< T >::length ( ) const
inline

◆ lengthSq()

template<typename T >
T MR::Vector2< T >::lengthSq ( ) const
inline

◆ minusX()

template<typename T >
static constexpr Vector2 MR::Vector2< T >::minusX ( )
inlinestaticconstexprnoexcept

◆ minusY()

template<typename T >
static constexpr Vector2 MR::Vector2< T >::minusY ( )
inlinestaticconstexprnoexcept

◆ normalized()

template<typename T >
Vector2 MR::Vector2< T >::normalized ( ) const
inline

◆ operator*=()

template<typename T >
Vector2 & MR::Vector2< T >::operator*= ( T b)
inline

◆ operator+()

template<typename T >
const Vector2 & MR::Vector2< T >::operator+ ( ) const
inline

◆ operator+=()

template<typename T >
Vector2 & MR::Vector2< T >::operator+= ( const Vector2< T > & b)
inline

◆ operator-()

template<typename T >
Vector2 MR::Vector2< T >::operator- ( ) const
inline

◆ operator-=()

template<typename T >
Vector2 & MR::Vector2< T >::operator-= ( const Vector2< T > & b)
inline

◆ operator/=()

template<typename T >
Vector2 & MR::Vector2< T >::operator/= ( T b)
inline

◆ operator[]() [1/2]

template<typename T >
const T & MR::Vector2< T >::operator[] ( int e) const
inlineconstexprnoexcept

◆ operator[]() [2/2]

template<typename T >
T & MR::Vector2< T >::operator[] ( int e)
inlineconstexprnoexcept

◆ perpendicular()

template<typename T >
Vector2 furthestBasisVector() const MR_REQUIRES_IF_SUPPORTED(!std Vector2 MR::Vector2< T >::perpendicular ( ) const
inline

returns one of 2 basis unit vector that makes the biggest angle with the direction specified by this

returns same length vector orthogonal to this (rotated 90 degrees counter-clockwise)

◆ plusX()

template<typename T >
static constexpr Vector2 MR::Vector2< T >::plusX ( )
inlinestaticconstexprnoexcept

◆ plusY()

template<typename T >
static constexpr Vector2 MR::Vector2< T >::plusY ( )
inlinestaticconstexprnoexcept

Friends And Related Symbol Documentation

◆ angle()

template<typename T >
T angle ( const Vector2< T > & a,
const Vector2< T > & b )
related

angle in radians between two vectors

◆ cross()

template<typename T >
T cross ( const Vector2< T > & a,
const Vector2< T > & b )
related

cross product

◆ div()

template<typename T >
Vector2< T > div ( const Vector2< T > & a,
const Vector2< T > & b )
related

per component division

◆ dot()

template<typename T >
T dot ( const Vector2< T > & a,
const Vector2< T > & b )
related

dot product

◆ mult()

template<typename T >
Vector2< T > mult ( const Vector2< T > & a,
const Vector2< T > & b )
related

per component multiplication

◆ sqr()

template<typename T >
T sqr ( const Vector2< T > & a)
related

squared length

Member Data Documentation

◆ elements

template<typename T >
int MR::Vector2< T >::elements = 2
staticconstexpr

◆ x

template<typename T >
T MR::Vector2< T >::x

◆ y

template<typename T >
T MR::Vector2< T >::y

The documentation for this struct was generated from the following file: