MeshLib C++ Docs
Loading...
Searching...
No Matches

#include <MRMesh/MRVector4.h>

Public Types

using ValueType = T
using MatrixType = Matrix4<T>
using SymMatrixType = SymMatrix4<T>

Public Member Functions

constexpr Vector4 () noexcept
 Vector4 (NoInit) noexcept
constexpr Vector4 (T x, T y, T z, T w) noexcept
template<typename U>
 MR_REQUIRES_IF_SUPPORTED (!std::is_same_v< T, U >) const expr explicit Vector4(const Vector4< U > &v) noexcept
constexpr const T & operator[] (int e) const noexcept
constexpr T & operator[] (int e) noexcept
lengthSq () const
auto length () const
Vector4 normalized () const MR_REQUIRES_IF_SUPPORTED(!std
Vector3< T > proj3d () const MR_REQUIRES_IF_SUPPORTED(!std
 assuming this is a point represented in homogeneous 4D coordinates, returns the point as 3D-vector
bool isFinite () const MR_REQUIRES_IF_SUPPORTED(std

Static Public Member Functions

static constexpr Vector4 diagonal (T a) noexcept

Public Attributes

x
y
z
w

Static Public Attributes

static constexpr int elements = 4

Friends

constexpr bool operator== (const Vector4< T > &a, const Vector4< T > &b)
constexpr bool operator!= (const Vector4< T > &a, const Vector4< T > &b)
constexpr const Vector4< T > & operator+ (const Vector4< 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 Vector4< T > &a) -> Vector4< decltype(-std::declval< T >())>
constexpr auto operator+ (const Vector4< T > &a, const Vector4< T > &b) -> Vector4< decltype(std::declval< T >()+std::declval< T >())>
constexpr auto operator- (const Vector4< T > &a, const Vector4< T > &b) -> Vector4< decltype(std::declval< T >() - std::declval< T >())>
constexpr auto operator* (T a, const Vector4< T > &b) -> Vector4< decltype(std::declval< T >() *std::declval< T >())>
constexpr auto operator* (const Vector4< T > &b, T a) -> Vector4< decltype(std::declval< T >() *std::declval< T >())>
constexpr auto operator/ (Vector4< T > b, T a) -> Vector4< decltype(std::declval< T >()/std::declval< T >())>
constexpr Vector4< T > & operator+= (Vector4< T > &a, const Vector4< T > &b)
constexpr Vector4< T > & operator-= (Vector4< T > &a, const Vector4< T > &b)
constexpr Vector4< T > & operator*= (Vector4< T > &a, T b)
constexpr Vector4< T > & operator/= (Vector4< T > &a, T b)
std::ostream & operator<< (std::ostream &s, const Vector4 &vec)
std::istream & operator>> (std::istream &s, Vector4 &vec)
MR_BIND_IGNORE friend auto begin (const Vector4 &v)
MR_BIND_IGNORE friend auto begin (Vector4 &v)
MR_BIND_IGNORE friend auto end (const Vector4 &v)
MR_BIND_IGNORE friend auto end (Vector4 &v)

(Note that these are not member symbols.)

template<typename T>
distanceSq (const Vector4< T > &a, const Vector4< T > &b)
 squared distance between two points, which is faster to compute than just distance
template<typename T>
distance (const Vector4< T > &a, const Vector4< T > &b)
 distance between two points, better use distanceSq for higher performance
template<typename T>
auto dot (const Vector4< T > &a, const Vector4< T > &b) -> decltype(a.x *b.x)
 dot product
template<typename T>
sqr (const Vector4< T > &a)
 squared length
template<typename T>
Vector4< T > mult (const Vector4< T > &a, const Vector4< T > &b)
 per component multiplication
template<typename T>
Vector4< T > div (const Vector4< T > &a, const Vector4< T > &b)
 per component division

Detailed Description

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

four-dimensional vector


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