template<class T>
Vector4 class
Four-component vector.
Template parameters | |
---|---|
T | Data type |
Contents
See Operations with matrices and vectors for brief introduction.
Base classes
-
template<std::class Vector
size_t size, class T> - Vector.
Derived classes
Public static functions
-
template<std::static auto pad(const Vector<otherSize, T>& a, T xyz, T w) -> Vector4<T> constexpr
size_t otherSize> - Pad vector to four-component one.
Constructors, destructors, conversion operators
- Vector4(ZeroInitT = ZeroInit) constexpr noexcept
- Default constructor.
- Vector4(NoInitT) explicit noexcept
- Construct vector without initializing the contents.
- Vector4(T value) explicit constexpr noexcept
- Construct vector with one value for all components.
- Vector4(T x, T y, T z, T w) constexpr noexcept
- Constructor.
- Vector4(const Vector3<T>& xyz, T w) constexpr noexcept
- Constructor.
-
template<class U>Vector4(const Vector<4, U>& other) explicit constexpr noexcept
- Construct vector from another of different type.
-
template<class U, class V = decltype(Implementation::VectorConverter<4, T, U>::from(std::Vector4(const U& other) explicit constexpr
declval<U>()))> - Construct vector from external representation.
- Vector4(const Vector<4, T>& other) constexpr noexcept
- Copy constructor.
Public functions
- auto x() -> T&
- X component.
- auto x() const -> T constexpr
- auto y() -> T&
- Y component.
- auto y() const -> T constexpr
- auto z() -> T&
- Z component.
- auto z() const -> T constexpr
- auto w() -> T&
- W component.
- auto w() const -> T constexpr
- auto r() -> T&
- R component.
- auto r() const -> T constexpr
- auto g() -> T&
- G component.
- auto g() const -> T constexpr
- auto b() -> T&
- B component.
- auto b() const -> T constexpr
- auto a() -> T&
- A component.
- auto a() const -> T constexpr
- auto xyz() -> Vector3<T>&
- XYZ part of the vector.
- auto xyz() const -> const Vector3<T> constexpr
- auto rgb() -> Vector3<T>&
- RGB part of the vector.
- auto rgb() const -> const Vector3<T> constexpr
- auto xy() -> Vector2<T>&
- XY part of the vector.
- auto xy() const -> const Vector2<T> constexpr
Function documentation
template<class T>
template<std:: size_t otherSize>
static Vector4<T> Magnum:: Math:: Vector4<T>:: pad(const Vector<otherSize, T>& a,
T xyz,
T w) constexpr
Pad vector to four-component one.
If size of a
is smaller than 4, it is padded from right with xyz
for first three component and w
for fourth component, otherwise it's cut.
template<class T>
Magnum:: Math:: Vector4<T>:: Vector4(T x,
T y,
T z,
T w) constexpr noexcept
Constructor.
template<class T>
template<class U>
Magnum:: Math:: Vector4<T>:: Vector4(const Vector<4, U>& other) explicit constexpr noexcept
Construct vector from another of different type.
Performs only default casting on the values, no rounding or anything else. Example usage:
Vector<4, Float> floatingPoint(1.3f, 2.7f, -15.0f, 7.0f); Vector<4, Byte> integral(floatingPoint); // integral == {1, 2, -15, 7}
template<class T>
T& Magnum:: Math:: Vector4<T>:: x()
X component.
template<class T>
T Magnum:: Math:: Vector4<T>:: x() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T& Magnum:: Math:: Vector4<T>:: y()
Y component.
template<class T>
T Magnum:: Math:: Vector4<T>:: y() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T& Magnum:: Math:: Vector4<T>:: z()
Z component.
template<class T>
T Magnum:: Math:: Vector4<T>:: z() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T& Magnum:: Math:: Vector4<T>:: w()
W component.
template<class T>
T Magnum:: Math:: Vector4<T>:: w() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Math:: Vector4<T>:: r() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Math:: Vector4<T>:: g() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Math:: Vector4<T>:: b() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
T Magnum:: Math:: Vector4<T>:: a() const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.