Rebel Fork Framework
Urho3D::Vector4 Class Reference

Four-dimensional vector. More...

#include <Urho3D/Math/Vector4.h>

Public Member Functions

 Vector4 () noexcept
 Construct a zero vector.
 
 Vector4 (const Vector4 &vector) noexcept=default
 Copy-construct from another vector.
 
 Vector4 (const Vector3 &v1, float w) noexcept
 Construct from 3-dimensional vector and a scalar.
 
 Vector4 (const Vector2 &v1, const Vector2 &v2) noexcept
 Construct from two 2-dimensional vectors.
 
 Vector4 (float x, float y, float z, float w) noexcept
 Construct from coordinates.
 
 Vector4 (const float data[]) noexcept
 Construct from a float array.
 
Vector4operator= (const Vector4 &rhs) noexcept=default
 Assign from another vector.
 
bool operator== (const Vector4 &rhs) const
 Test for equality with another vector without epsilon.
 
bool operator!= (const Vector4 &rhs) const
 Test for inequality with another vector without epsilon.
 
Vector4 operator+ (const Vector4 &rhs) const
 Add a vector.
 
Vector4 operator- () const
 Return negation.
 
Vector4 operator- (const Vector4 &rhs) const
 Subtract a vector.
 
Vector4 operator* (float rhs) const
 Multiply with a scalar.
 
Vector4 operator* (const Vector4 &rhs) const
 Multiply with a vector.
 
Vector4 operator/ (float rhs) const
 Divide by a scalar.
 
Vector4 operator/ (const Vector4 &rhs) const
 Divide by a vector.
 
Vector4operator+= (const Vector4 &rhs)
 Add-assign a vector.
 
Vector4operator-= (const Vector4 &rhs)
 Subtract-assign a vector.
 
Vector4operator*= (float rhs)
 Multiply-assign a scalar.
 
Vector4operator*= (const Vector4 &rhs)
 Multiply-assign a vector.
 
Vector4operator/= (float rhs)
 Divide-assign a scalar.
 
Vector4operator/= (const Vector4 &rhs)
 Divide-assign a vector.
 
float operator[] (unsigned index) const
 Return const value by index.
 
float & operator[] (unsigned index)
 Return mutable value by index.
 
float Length () const
 
float LengthSquared () const
 
float DotProduct (const Vector4 &rhs) const
 Calculate dot product.
 
float AbsDotProduct (const Vector4 &rhs) const
 Calculate absolute dot product.
 
float ProjectOntoAxis (const Vector3 &axis) const
 Project vector onto axis.
 
Vector4 Abs () const
 Return absolute vector.
 
Vector4 Lerp (const Vector4 &rhs, float t) const
 Linear interpolation with another vector.
 
bool Equals (const Vector4 &rhs, float eps=M_EPSILON) const
 Test for equality with another vector with epsilon.
 
bool IsNaN () const
 Return whether any component is NaN.
 
bool IsInf () const
 Return whether any component is Inf.
 
IntVector2 ToIntVector2 () const
 Return IntVector2 vector (z, w components are ignored).
 
Vector2 ToVector2 () const
 Return Vector2 vector (z, w components are ignored).
 
IntVector3 ToIntVector3 () const
 Return IntVector3 vector (w component is ignored).
 
Vector3 ToVector3 () const
 Return Vector3 vector (w component is ignored).
 
const float * Data () const
 Return float data.
 
ea::string ToString () const
 Return as string.
 
unsigned ToHash () const
 Return hash value for HashSet & HashMap.
 

Public Attributes

float x_
 X coordinate.
 
float y_
 Y coordinate.
 
float z_
 Z coordinate.
 
float w_
 W coordinate.
 

Static Public Attributes

static const Vector4 ZERO
 Zero vector.
 
static const Vector4 ONE
 (1,1,1) vector.
 

Detailed Description

Four-dimensional vector.

Member Function Documentation

◆ Length()

float Urho3D::Vector4::Length ( ) const
inline

Return length.

◆ LengthSquared()

float Urho3D::Vector4::LengthSquared ( ) const
inline

Return squared length.


The documentation for this class was generated from the following files: