MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::Vector3< T > Struct Template Reference

#include <MRVector3.h>

Public Types

using ValueType = T
 
using MatrixType = Matrix3<T>
 
using SymMatrixType = SymMatrix3<T>
 

Public Member Functions

constexpr Vector3 () noexcept
 
 Vector3 (NoInit) noexcept
 
constexpr Vector3 (T x, T y, T z) noexcept
 
template<typename U >
 MR_REQUIRES_IF_SUPPORTED (std::constructible_from< T, U >) explicit const expr Vector3(const Vector2< U > &v) noexcept
 
template<typename U >
 MR_REQUIRES_IF_SUPPORTED (!std::is_same_v< T, U >) const expr explicit Vector3(const Vector3< U > &v) noexcept
 
constexpr const T & operator[] (int e) const noexcept
 
constexpr T & operator[] (int e) noexcept
 
lengthSq () const
 
auto length () const
 
Vector3 normalized () const MR_REQUIRES_IF_SUPPORTED(std
 
template<MR_SAME_TYPE_TEMPLATE_PARAM(T, TT) >
Vector3 furthestBasisVector() const MR_REQUIRES_IF_SUPPORTED(!std std::pair< Vector3, Vector3 > perpendicular() const MR_REQUIRES_IF_SUPPORTED(std Vector3 transformed (const AffineXf3< TT > *xf) const MR_REQUIRES_IF_SUPPORTED(std
 returns one of 3 basis unit vector that makes the biggest angle with the direction specified by this
 
void unsignZeroValues () MR_REQUIRES_IF_SUPPORTED(std
 get rid of signed zero values to be sure that equal vectors have identical binary representation
 
bool isFinite () const MR_REQUIRES_IF_SUPPORTED(std
 

Static Public Member Functions

static constexpr Vector3 diagonal (T a) noexcept
 
static constexpr Vector3 plusX () noexcept
 
static constexpr Vector3 plusY () noexcept
 
static constexpr Vector3 plusZ () noexcept
 
static constexpr Vector3 minusX () noexcept MR_REQUIRES_IF_SUPPORTED(!std
 
static constexpr Vector3 minusY () noexcept MR_REQUIRES_IF_SUPPORTED(!std
 
static constexpr Vector3 minusZ () noexcept MR_REQUIRES_IF_SUPPORTED(!std
 

Public Attributes

x
 
y
 
z
 

Static Public Attributes

static constexpr int elements = 3
 

Friends

constexpr bool operator== (const Vector3< T > &a, const Vector3< T > &b)
 
constexpr bool operator!= (const Vector3< T > &a, const Vector3< T > &b)
 
constexpr const Vector3< T > & operator+ (const Vector3< T > &a)
 NOTE: We use std::declval() in the operators below because libclang 18 in our binding generator is bugged and chokes on decltyping a.x and such. TODO fix this when we update libclang.
 
constexpr auto operator- (const Vector3< T > &a) -> Vector3< decltype(-std::declval< T >())>
 
constexpr auto operator+ (const Vector3< T > &a, const Vector3< T > &b) -> Vector3< decltype(std::declval< T >()+std::declval< T >())>
 
constexpr auto operator- (const Vector3< T > &a, const Vector3< T > &b) -> Vector3< decltype(std::declval< T >() - std::declval< T >())>
 
constexpr auto operator* (T a, const Vector3< T > &b) -> Vector3< decltype(std::declval< T >() *std::declval< T >())>
 
constexpr auto operator* (const Vector3< T > &b, T a) -> Vector3< decltype(std::declval< T >() *std::declval< T >())>
 
constexpr auto operator/ (Vector3< T > b, T a) -> Vector3< decltype(std::declval< T >()/std::declval< T >())>
 
constexpr Vector3< T > & operator+= (Vector3< T > &a, const Vector3< T > &b)
 
constexpr Vector3< T > & operator-= (Vector3< T > &a, const Vector3< T > &b)
 
constexpr Vector3< T > & operator*= (Vector3< T > &a, T b)
 
constexpr Vector3< T > & operator/= (Vector3< T > &a, T b)
 
std::ostream & operator<< (std::ostream &s, const Vector3 &vec)
 
std::istream & operator>> (std::istream &s, Vector3 &vec)
 

Related Symbols

(Note that these are not member symbols.)

template<typename T >
distanceSq (const Vector3< T > &a, const Vector3< T > &b)
 squared distance between two points, which is faster to compute than just distance
 
template<typename T >
distance (const Vector3< T > &a, const Vector3< T > &b)
 distance between two points, better use distanceSq for higher performance
 
template<typename T >
Vector3< T > cross (const Vector3< T > &a, const Vector3< T > &b)
 cross product
 
template<typename T >
auto dot (const Vector3< T > &a, const Vector3< T > &b) -> decltype(a.x *b.x)
 dot product
 
template<typename T >
sqr (const Vector3< T > &a)
 squared length
 
template<typename T >
mixed (const Vector3< T > &a, const Vector3< T > &b, const Vector3< T > &c)
 mixed product
 
template<typename T >
Vector3< T > mult (const Vector3< T > &a, const Vector3< T > &b)
 per component multiplication
 
template<typename T >
Vector3< T > div (const Vector3< T > &a, const Vector3< T > &b)
 per component division
 
template<typename T >
angle (const Vector3< T > &a, const Vector3< T > &b)
 
template<typename T >
Vector3< T > unitVector3 (T azimuth, T altitude)
 returns a point on unit sphere given two angles
 
template<typename T >
MR_BIND_IGNORE_PY auto begin (const Vector3< T > &v)
 We don't need to bind those functions in Python, because this doesn't prevent __iter__ from being generated for the type.
 

Detailed Description

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

three-dimensional vector


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