Vector4-Impl.h
Go to the documentation of this file.
353 return Vector<U, 4>(static_cast<U>(x), static_cast<U>(y), static_cast<U>(z), static_cast<U>(w));
365 return (std::fabs(x - other.x) < epsilon) && (std::fabs(y - other.y) < epsilon && std::fabs(z - other.z) < epsilon) && (std::fabs(w - other.w) < epsilon);
552 return Vector<T, 4>(std::min(a.x, b.x), std::min(a.y, b.y), std::min(a.z, b.z), std::min(a.w, b.w));
558 return Vector<T, 4>(std::max(a.x, b.x), std::max(a.y, b.y), std::max(a.z, b.z), std::max(a.w, b.w));
564 return Vector<T, 4>(Clamp(v.x, low.x, high.x), Clamp(v.y, low.y, high.y), Clamp(v.z, low.z, high.z), Clamp(v.w, low.w, high.w));
T AbsMin(T x, T y)
Returns the absolute minimum value among the two inputs.
Definition: MathUtils-Impl.h:39
VectorScalarRDiv< T, Vector > RDiv(const T &s) const
Computes (s, s, ... , s) / this.
Definition: Vector-Impl.h:440
Vector Div(T v) const
Computes this / (v, v, v, v).
Definition: Vector4-Impl.h:132
size_t DominantAxis() const
Returns the index of the dominant axis.
Definition: Vector-Impl.h:247
T DistanceTo(const E &other) const
Returns the distance to the other vector.
Definition: Vector-Impl.h:289
Point< T, 2 > Ceil(const Point< T, 2 > &a)
Returns element-wise ceiled point.
Definition: Point2-Impl.h:492
const T & operator[](size_t i) const
Returns the const reference to the i -th element.
Definition: Vector-Impl.h:519
Matrix< T, 2, 2 > operator+(const Matrix< T, 2, 2 > &a, const Matrix< T, 2, 2 > &b)
Returns a + b (element-size).
Definition: Matrix2x2-Impl.h:660
size_t SubdominantAxis() const
Returns the index of the subdominant axis.
Definition: Vector-Impl.h:258
VectorTypeCast< U, Vector< T, N >, T > CastTo() const
Returns a vector with different value type.
Definition: Vector-Impl.h:313
Vector & operator=(const std::initializer_list< U > &list)
Set vector instance with initializer list.
bool IsEqual(const E &other) const
Returns true if other is the same as this vector.
Definition: Vector-Impl.h:320
T LengthSquared() const
Returns the squared length of the vector.
Definition: Vector-Impl.h:282
T At(size_t i) const
Returns const reference to the i -th element of the vector.
Definition: Vector-Impl.h:164
Point< T, 2 > Floor(const Point< T, 2 > &a)
Returns element-wise floored point.
Definition: Point2-Impl.h:498
Vector RDiv(T v) const
Computes (v, v, v, v) / this.
Definition: Vector4-Impl.h:162
bool operator==(const E &v) const
Returns true if other is the same as this vector.
Definition: Vector-Impl.h:608
Matrix< T, 2, 2 > operator/(const Matrix< T, 2, 2 > &a, T b)
Definition: Matrix2x2-Impl.h:720
Definition: pybind11Utils.h:24
void IAdd(const T &s)
Computes this += (s, s, ... , s).
Definition: Vector-Impl.h:453
T Clamp(T val, T low, T high)
Returns the clamped value.
Definition: MathUtils-Impl.h:123
Vector & operator-=(const T &s)
Computes this -= (s, s, ... , s)
Definition: Vector-Impl.h:562
T Avg() const
Returns the average of all the elements.
Definition: Vector-Impl.h:189
void IMul(const T &s)
Computes this *= (s, s, ... , s).
Definition: Vector-Impl.h:479
VectorScalarDiv< T, Vector > Normalized() const
Returns normalized vector.
Definition: Vector-Impl.h:269
Matrix< T, 2, 2 > operator-(const Matrix< T, 2, 2 > &a)
Returns a matrix with opposite sign.
Definition: Matrix2x2-Impl.h:654
Vector & operator*=(const T &s)
Computes this *= (s, s, ... , s)
Definition: Vector-Impl.h:577
Point< T, 2 > Max(const Point< T, 2 > &a, const Point< T, 2 > &b)
Returns element-wise max point: (max(a.x, b.x), max(a.y, b.y)).
Definition: Point2-Impl.h:480
Vector Sub(T v) const
Computes this - (v, v, v, v).
Definition: Vector4-Impl.h:108
Vector & operator/=(const T &s)
Computes this /= (s, s, ... , s)
Definition: Vector-Impl.h:592
Vector & operator+=(const T &s)
Computes this += (s, s, ... , s)
Definition: Vector-Impl.h:547
T AbsMax() const
Returns the absolute maximum element.
Definition: Vector-Impl.h:234
T DistanceSquaredTo(const E &other) const
Returns the squared distance to the other vector.
Definition: Vector-Impl.h:296
T Sum() const
Returns the sum of all the elements.
Definition: Vector-Impl.h:176
Vector RSub(T v) const
Computes (v, v, v, v) - this.
Definition: Vector4-Impl.h:150
Vector Mul(T v) const
Computes this * (v, v, v, v).
Definition: Vector4-Impl.h:120
bool IsSimilar(const E &other, T epsilon=std::numeric_limits< T >::epsilon()) const
Returns true if other is similar to this vector.
Definition: Vector-Impl.h:340
T AbsMin() const
Returns the absolute minimum element.
Definition: Vector-Impl.h:221
Vector< T, 3 > operator*(const Quaternion< T > &q, const Vector< T, 3 > &v)
Returns quaternion q * vector v.
Definition: Quaternion-Impl.h:481
T MonotonicCatmullRom(const T &f0, const T &f1, const T &f2, const T &f3, T f)
Computes monotonic Catmull-Rom interpolation.
Definition: MathUtils-Impl.h:228
Vector Add(T v) const
Computes this + (v, v, v, v).
Definition: Vector4-Impl.h:96
T AbsMax(T x, T y)
Returns the absolute maximum value among the two inputs.
Definition: MathUtils-Impl.h:45
void ISub(const T &s)
Computes this -= (s, s, ... , s).
Definition: Vector-Impl.h:466
bool operator!=(const E &v) const
Returns true if other is the not same as this vector.
Definition: Vector-Impl.h:615
Point< T, 2 > Min(const Point< T, 2 > &a, const Point< T, 2 > &b)
Returns element-wise min point: (min(a.x, b.x), min(a.y, b.y)).
Definition: Point2-Impl.h:474
VectorScalarRSub< T, Vector > RSub(const T &s) const
Computes (s, s, ... , s) - this.
Definition: Vector-Impl.h:427
T Length() const
Returns the length of the vector.
Definition: Vector-Impl.h:276
void IDiv(const T &s)
Computes this /= (s, s, ... , s).
Definition: Vector-Impl.h:492