Urho3D
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Urho3D::Vector2 Class Reference

Two-dimensional vector. More...

#include </home/runner/work/urho3d-doxygen.github.io/urho3d-doxygen.github.io/urho3d_repo/Source/Urho3D/Math/Vector2.h>

Public Member Functions

 Vector2 () noexcept
 Construct a zero vector.
 
 Vector2 (const Vector2 &vector) noexcept=default
 Copy-construct from another vector.
 
 Vector2 (const IntVector2 &vector) noexcept
 Construct from an IntVector2.
 
 Vector2 (float x, float y) noexcept
 Construct from coordinates.
 
 Vector2 (i32 x, i32 y) noexcept
 Construct from int coordinates.
 
 Vector2 (const float *data) noexcept
 Construct from a float array.
 
Vector2operator= (const Vector2 &rhs) noexcept=default
 Assign from another vector.
 
bool operator== (const Vector2 &rhs) const
 Test for equality with another vector without epsilon.
 
bool operator!= (const Vector2 &rhs) const
 Test for inequality with another vector without epsilon.
 
Vector2 operator+ (const Vector2 &rhs) const
 Add a vector.
 
Vector2 operator- () const
 Return negation.
 
Vector2 operator- (const Vector2 &rhs) const
 Subtract a vector.
 
Vector2 operator* (float rhs) const
 Multiply with a scalar.
 
Vector2 operator* (const Vector2 &rhs) const
 Multiply with a vector.
 
Vector2 operator/ (float rhs) const
 Divide by a scalar.
 
Vector2 operator/ (const Vector2 &rhs) const
 Divide by a vector.
 
Vector2operator+= (const Vector2 &rhs)
 Add-assign a vector.
 
Vector2operator-= (const Vector2 &rhs)
 Subtract-assign a vector.
 
Vector2operator*= (float rhs)
 Multiply-assign a scalar.
 
Vector2operator*= (const Vector2 &rhs)
 Multiply-assign a vector.
 
Vector2operator/= (float rhs)
 Divide-assign a scalar.
 
Vector2operator/= (const Vector2 &rhs)
 Divide-assign a vector.
 
void Normalize ()
 Normalize to unit length.
 
float Length () const
 Return length.
 
float LengthSquared () const
 Return squared length.
 
float DotProduct (const Vector2 &rhs) const
 Calculate dot product.
 
float AbsDotProduct (const Vector2 &rhs) const
 Calculate absolute dot product.
 
float ProjectOntoAxis (const Vector2 &axis) const
 Project vector onto axis.
 
float Angle (const Vector2 &rhs) const
 Returns the angle between this vector and another vector in degrees.
 
Vector2 Abs () const
 Return absolute vector.
 
Vector2 Lerp (const Vector2 &rhs, float t) const
 Linear interpolation with another vector.
 
bool Equals (const Vector2 &rhs) 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.
 
Vector2 Normalized () const
 Return normalized to unit length.
 
Vector2 NormalizedOrDefault (const Vector2 &defaultValue=Vector2::ZERO, float eps=M_LARGE_EPSILON) const
 Return normalized to unit length or zero if length is too small.
 
Vector2 ReNormalized (float minLength, float maxLength, const Vector2 &defaultValue=Vector2::ZERO, float eps=M_LARGE_EPSILON) const
 Return normalized vector with length in given range.
 
const float * Data () const
 Return float data.
 
String ToString () const
 Return as string.
 

Public Attributes

float x_
 X coordinate.
 
float y_
 Y coordinate.
 

Static Public Attributes

static const Vector2 ZERO
 Zero vector.
 
static const Vector2 LEFT
 (-1,0) vector.
 
static const Vector2 RIGHT
 (1,0) vector.
 
static const Vector2 UP
 (0,1) vector.
 
static const Vector2 DOWN
 (0,-1) vector.
 
static const Vector2 ONE
 (1,1) vector.
 

Detailed Description

Two-dimensional vector.


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