CARLA
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
carla::geom::Vector2D Struct Reference

#include <Vector2D.h>

Public Member Functions

float Length () const
 
Vector2D MakeUnitVector (const float epsilon=2.0f *std::numeric_limits< float >::epsilon()) const
 Return a unit-length copy of this vector.
 
bool operator!= (const Vector2D &rhs) const
 
Vector2D & operator*= (float rhs)
 
Vector2D & operator+= (const Vector2D &rhs)
 
Vector2D & operator-= (const Vector2D &rhs)
 
Vector2D & operator/= (float rhs)
 
bool operator== (const Vector2D &rhs) const
 
float SquaredLength () const
 
Vector2D ToCentimeters () const
 Return a Vector2D converted from meters to centimeters.
 
FVector2D ToFVector2D () const
 
Vector2D ToMeters () const
 Return a Vector2D converted from centimeters to meters.
 
 Vector2D ()=default
 
 Vector2D (float ix, float iy)
 

Public Attributes

float x = 0.0f
 
float y = 0.0f
 

Static Public Attributes

static constexpr auto Dim = 2
 

Friends

Vector2D operator* (float lhs, Vector2D rhs)
 
Vector2D operator* (Vector2D lhs, float rhs)
 
Vector2D operator+ (Vector2D lhs, const Vector2D &rhs)
 
Vector2D operator- (Vector2D lhs, const Vector2D &rhs)
 
Vector2D operator/ (float lhs, Vector2D rhs)
 
Vector2D operator/ (Vector2D lhs, float rhs)
 

Detailed Description

Definition at line 17 of file geom/Vector2D.h.

Constructor & Destructor Documentation

◆ Vector2D() [1/2]

carla::geom::Vector2D::Vector2D ( )
default

Referenced by MakeUnitVector().

◆ Vector2D() [2/2]

carla::geom::Vector2D::Vector2D ( float  ix,
float  iy 
)
inline

Definition at line 35 of file geom/Vector2D.h.

Member Function Documentation

◆ Length()

float carla::geom::Vector2D::Length ( ) const
inline

Definition at line 47 of file geom/Vector2D.h.

References SquaredLength().

Referenced by MakeUnitVector().

◆ MakeUnitVector()

Vector2D carla::geom::Vector2D::MakeUnitVector ( const float  epsilon = 2.0f * std::numeric_limits<float>::epsilon()) const
inline

Return a unit-length copy of this vector.

When the vector's length is at or below epsilon, the input is returned unchanged (no runtime assert, no NaN).

Definition at line 54 of file geom/Vector2D.h.

References Length(), Vector2D(), x, and y.

◆ operator!=()

bool carla::geom::Vector2D::operator!= ( const Vector2D &  rhs) const
inline

Definition at line 130 of file geom/Vector2D.h.

◆ operator*=()

Vector2D & carla::geom::Vector2D::operator*= ( float  rhs)
inline

Definition at line 90 of file geom/Vector2D.h.

References x, and y.

◆ operator+=()

Vector2D & carla::geom::Vector2D::operator+= ( const Vector2D &  rhs)
inline

Definition at line 68 of file geom/Vector2D.h.

References x, and y.

◆ operator-=()

Vector2D & carla::geom::Vector2D::operator-= ( const Vector2D &  rhs)
inline

Definition at line 79 of file geom/Vector2D.h.

References x, and y.

◆ operator/=()

Vector2D & carla::geom::Vector2D::operator/= ( float  rhs)
inline

Definition at line 106 of file geom/Vector2D.h.

References x, and y.

◆ operator==()

bool carla::geom::Vector2D::operator== ( const Vector2D &  rhs) const
inline

Definition at line 126 of file geom/Vector2D.h.

References x, and y.

◆ SquaredLength()

float carla::geom::Vector2D::SquaredLength ( ) const
inline

Definition at line 43 of file geom/Vector2D.h.

References x, and y.

Referenced by Length().

◆ ToCentimeters()

Vector2D carla::geom::Vector2D::ToCentimeters ( ) const
inline

Return a Vector2D converted from meters to centimeters.

Definition at line 146 of file geom/Vector2D.h.

◆ ToFVector2D()

FVector2D carla::geom::Vector2D::ToFVector2D ( ) const
inline

Definition at line 150 of file geom/Vector2D.h.

References x, and y.

◆ ToMeters()

Vector2D carla::geom::Vector2D::ToMeters ( ) const
inline

Return a Vector2D converted from centimeters to meters.

Definition at line 141 of file geom/Vector2D.h.

Friends And Related Symbol Documentation

◆ operator* [1/2]

Vector2D operator* ( float  lhs,
Vector2D  rhs 
)
friend

Definition at line 101 of file geom/Vector2D.h.

◆ operator* [2/2]

Vector2D operator* ( Vector2D  lhs,
float  rhs 
)
friend

Definition at line 96 of file geom/Vector2D.h.

◆ operator+

Vector2D operator+ ( Vector2D  lhs,
const Vector2D &  rhs 
)
friend

Definition at line 74 of file geom/Vector2D.h.

◆ operator-

Vector2D operator- ( Vector2D  lhs,
const Vector2D &  rhs 
)
friend

Definition at line 85 of file geom/Vector2D.h.

◆ operator/ [1/2]

Vector2D operator/ ( float  lhs,
Vector2D  rhs 
)
friend

Definition at line 117 of file geom/Vector2D.h.

◆ operator/ [2/2]

Vector2D operator/ ( Vector2D  lhs,
float  rhs 
)
friend

Definition at line 112 of file geom/Vector2D.h.

Member Data Documentation

◆ Dim

constexpr auto carla::geom::Vector2D::Dim = 2
staticconstexpr

Definition at line 19 of file geom/Vector2D.h.

◆ x

float carla::geom::Vector2D::x = 0.0f

◆ y

float carla::geom::Vector2D::y = 0.0f

The documentation for this struct was generated from the following file: