#include <MRMesh/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 |
| template<typename U> | |
| MR_REQUIRES_IF_SUPPORTED (std::constructible_from< T, U >) explicit const expr Vector2(const Vector3< U > &v) noexcept | |
| template<typename U> | |
| MR_REQUIRES_IF_SUPPORTED (!std::is_same_v< T, U >) const expr explicit Vector2(const Vector2< U > &v) noexcept | |
| constexpr const T & | operator[] (int e) const noexcept |
| constexpr T & | operator[] (int e) noexcept |
| T | lengthSq () const |
| auto | length () const |
| Vector2 | normalized () const MR_REQUIRES_IF_SUPPORTED(!std |
| Vector2 furthestBasisVector() const MR_REQUIRES_IF_SUPPORTED(!std constexpr 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 | |
| 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 MR_REQUIRES_IF_SUPPORTED(!std |
| static constexpr Vector2 | minusY () noexcept MR_REQUIRES_IF_SUPPORTED(!std |
Public Attributes | |
| T | x |
| T | y |
Static Public Attributes | |
| static constexpr int | elements = 2 |
Friends | |
| constexpr bool | operator== (const Vector2< T > &a, const Vector2< T > &b) |
| constexpr bool | operator!= (const Vector2< T > &a, const Vector2< T > &b) |
| constexpr const Vector2< T > & | operator+ (const Vector2< 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 Vector2< T > &a) -> Vector2< decltype(-std::declval< T >())> |
| constexpr auto | operator+ (const Vector2< T > &a, const Vector2< T > &b) -> Vector2< decltype(std::declval< T >()+std::declval< T >())> |
| constexpr auto | operator- (const Vector2< T > &a, const Vector2< T > &b) -> Vector2< decltype(std::declval< T >() - std::declval< T >())> |
| constexpr auto | operator* (T a, const Vector2< T > &b) -> Vector2< decltype(std::declval< T >() *std::declval< T >())> |
| constexpr auto | operator* (const Vector2< T > &b, T a) -> Vector2< decltype(std::declval< T >() *std::declval< T >())> |
| constexpr auto | operator/ (Vector2< T > b, T a) -> Vector2< decltype(std::declval< T >()/std::declval< T >())> |
| constexpr Vector2< T > & | operator+= (Vector2< T > &a, const Vector2< T > &b) |
| constexpr Vector2< T > & | operator-= (Vector2< T > &a, const Vector2< T > &b) |
| constexpr Vector2< T > & | operator*= (Vector2< T > &a, T b) |
| constexpr Vector2< T > & | operator/= (Vector2< T > &a, T b) |
| std::ostream & | operator<< (std::ostream &s, const Vector2 &vec) |
| std::istream & | operator>> (std::istream &s, Vector2 &vec) |
| MR_BIND_IGNORE friend auto | begin (const Vector2 &v) |
| MR_BIND_IGNORE friend auto | begin (Vector2 &v) |
| MR_BIND_IGNORE friend auto | end (const Vector2 &v) |
| MR_BIND_IGNORE friend auto | end (Vector2 &v) |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<typename T> | |
| T | distanceSq (const Vector2< T > &a, const Vector2< T > &b) |
| squared distance between two points, which is faster to compute than just distance | |
| template<typename T> | |
| T | distance (const Vector2< T > &a, const Vector2< T > &b) |
| distance between two points, better use distanceSq for higher performance | |
| template<typename T> | |
| T | cross (const Vector2< T > &a, const Vector2< T > &b) |
| cross product | |
| template<typename T> | |
| auto | dot (const Vector2< T > &a, const Vector2< T > &b) -> decltype(a.x *b.x) |
| dot product | |
| template<typename T> | |
| 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> | |
| T | angle (const Vector2< T > &a, const Vector2< T > &b) |
| angle in radians between two vectors | |
two-dimensional vector
| using MR::Vector2< T >::MatrixType = Matrix2<T> |
| using MR::Vector2< T >::SymMatrixType = SymMatrix2<T> |
| using MR::Vector2< T >::ValueType = T |
|
inlineconstexprnoexcept |
|
inlineexplicitnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlinenodiscard |
|
inline |
Calling sqrt this way to hopefully support boost.multiprecision numbers. Returning auto to not break on integral types.
|
inline |
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlinenoexcept |
Here T == U doesn't seem to cause any issues in the C++ code, but we're still disabling it because it somehow gets emitted when generating the bindings, and looks out of place there.
|
inlinenoexcept |
|
inline |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
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)
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
angle in radians between two vectors
this version is slower and less precise return std::acos( std::clamp( dot( a.normalized(), b.normalized() ), T(-1), T(1) ) );
|
friend |
We don't need to bind those functions in Python, because this doesn't prevent __iter__ from being generated for the type. Those don't bind correctly in C#, because there we can't overload functions based on mutable struct ref vs const struct ref parameters.
|
friend |
distance between two points, better use distanceSq for higher performance
squared distance between two points, which is faster to compute than just distance
per component division
|
dot product
|
friend |
|
friend |
per component multiplication
|
friend |
|
friend |
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.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
squared length
|
staticconstexpr |
| T MR::Vector2< T >::x |
| T MR::Vector2< T >::y |