// L=============================================================================
// L This software is distributed under the MIT license.
// L Copyright 2021 Péter Kardos
// L=============================================================================
#pragma once
#include "VectorImpl.hpp"
namespace mathter {
/// Concatenates the arguments, and returns the concatenated vector.
template
mathter::Vector operator|(const mathter::Vector& lhs, U rhs) {
mathter::Vector ret;
for (int i = 0; i < Dim; ++i) {
ret(i) = lhs(i);
}
ret(Dim) = rhs;
return ret;
}
/// Concatenates the arguments, and returns the concatenated vector.
template
mathter::Vector operator|(const mathter::Vector& lhs, const mathter::Vector& rhs) {
mathter::Vector ret;
for (int i = 0; i < Dim1; ++i) {
ret(i) = lhs(i);
}
for (int i = 0; i < Dim2; ++i) {
ret(Dim1 + i) = rhs(i);
}
return ret;
}
/// Concatenates the arguments, and returns the concatenated vector.
template
mathter::Vector operator|(U lhs, const mathter::Vector& rhs) {
mathter::Vector ret;
ret(0) = lhs;
for (int i = 0; i < Dim; ++i) {
ret(i + 1) = rhs(i);
}
return ret;
}
/// Concatenates the arguments, and returns the concatenated vector.
template
auto operator|(const Swizzle& lhs, const Swizzle& rhs) {
using TS1 = typename traits::VectorTraits::Type;
using TS2 = typename traits::VectorTraits::Type;
return Vector(lhs) | Vector(rhs);
}
/// Concatenates the arguments, and returns the concatenated vector.
template
auto operator|(const Swizzle& lhs, const Vector& rhs) {
using TS = typename traits::VectorTraits::Type;
return Vector(lhs) | rhs;
}
/// Concatenates the arguments, and returns the concatenated vector.
template
auto operator|(const Vector& lhs, const Swizzle& rhs) {
using TS = typename traits::VectorTraits::Type;
return lhs | Vector(rhs);
}
/// Concatenates the arguments, and returns the concatenated vector.
template
auto operator|(const Swizzle& lhs, U rhs) {
using TS = typename traits::VectorTraits::Type;
return Vector(lhs) | rhs;
}
/// Concatenates the arguments, and returns the concatenated vector.
template
auto operator|(U lhs, const Swizzle& rhs) {
using TS = typename traits::VectorTraits::Type;
return lhs | Vector(rhs);
}
} // namespace mathter