ACF $AcfVersion:0$
Public Types | Public Member Functions | Static Public Member Functions | List of all members
i2d::CVector2d Class Reference

Definition of position or mathematical vector on 2D plane. More...

#include <CVector2d.h>

Inheritance diagram for i2d::CVector2d:
imath::TVector< 2 >

Public Types

typedef imath::TVector< 2 > BaseClass
 
- Public Types inherited from imath::TVector< 2 >
typedef double ElementType
 
typedef double Elements[Size]
 

Public Member Functions

 CVector2d ()
 Default constructor.
 
 CVector2d (double x, double y)
 Construct initializing elements to specified values.
 
 CVector2d (const istd::CIndex2d &index)
 
 CVector2d (const QPointF &point)
 
 CVector2d (const imath::TVector< 2 > &vector)
 Copy constructor.
 
double GetX () const
 Get X position of this vector.
 
void SetX (double x)
 Set X position of this vector.
 
double GetY () const
 Get Y position of this vector.
 
void SetY (double y)
 Set Y position of this vector.
 
void Init (double angle, double length=1.0)
 Init this vector using angle and vector length.
 
CVector2d GetTranslated (const imath::TVector< 2 > &vector)
 Get translated point.
 
CVector2d GetHorizontalTranslated (double offsetX) const
 Get horizontal translated point.
 
CVector2d GetVerticalTranslated (double offsetY) const
 Get vertical translated point.
 
double GetCrossProductZ (const imath::TVector< 2 > &vector) const
 Return Z coordinate of two vectors cross product.
 
double GetDotProduct (const CVector2d &vector) const
 
double GetAngle () const
 Get angle of this vector.
 
CVector2d GetOrthogonal () const
 Get orthogonal vector.
 
istd::CIndex2d ToIndex2d () const
 Get vector converted to 2D index.
 
CVector2d GetNormalized (double length=1.0) const
 Return normalized vector with the same direction and specified length.
 
bool Serialize (iser::IArchive &archive)
 Serialize this vector to specified archive.
 
CVector2d operator- () const
 
CVector2d operator+ (const imath::TVector< 2 > &vector) const
 
CVector2d operator- (const imath::TVector< 2 > &vector) const
 
CVector2d operator* (double scalar) const
 
CVector2d operator/ (double scalar) const
 
CVector2doperator+= (const imath::TVector< 2 > &vector)
 
CVector2doperator-= (const imath::TVector< 2 > &vector)
 
CVector2doperator*= (double scalar)
 
CVector2doperator/= (double scalar)
 
 operator QPointF () const
 
- Public Member Functions inherited from imath::TVector< 2 >
 TVector ()
 Creates an uninitialized vector.
 
 TVector (const TVector< Size, double > &vector)
 Creates a copy of another vector.
 
 TVector (std::initializer_list< double > values)
 Creates a vector from an initializer list.
 
const double & GetElement (int i) const
 Gets the element at the specified index (read-only).
 
double & GetElementRef (int i)
 Gets a reference to the element at the specified index (read-write).
 
void SetElement (int i, const double &value)
 Sets the element at the specified index.
 
void SetAllElements (const double &value)
 Sets all elements to the same value.
 
void Reset ()
 Sets all coordinates to zero.
 
void Clear ()
 Sets all coordinates to zero.
 
const TVector< Size, double >::Elements & GetElements () const
 Get read-only access to internal element container.
 
TVector< Size, double >::Elements & GetElementsRef ()
 Get access to internal element container.
 
void Translate (const TVector< Size, double > &vector)
 Translates (adds) another vector to this vector.
 
TVector< Size, double > GetTranslated (const TVector< Size, double > &vector)
 Returns a new vector that is the translation of this vector.
 
void GetTranslated (const TVector< Size, double > &vector, TVector< Size, double > &result)
 Computes the translated vector and stores it in the result parameter.
 
void ScaledCumulate (const TVector< Size, double > &vector, double scale)
 Adds a scaled vector to this vector.
 
bool IsNull (double tolerance=I_BIG_EPSILON) const
 Checks if this vector is null (all elements approximately zero).
 
double GetDotProduct (const TVector< Size, double > &vector) const
 Calculates the dot product with another vector.
 
double GetLength2 () const
 Calculates the squared Euclidean length of the vector.
 
double GetLength () const
 Calculates the Euclidean length (magnitude) of the vector.
 
double GetDistance2 (const TVector< Size, double > &vector) const
 Calculates the squared distance to another vector.
 
double GetDistance (const TVector< Size, double > &vector) const
 Calculates the Euclidean distance to another vector.
 
double GetElementsSum () const
 Calculates the sum of all vector elements.
 
bool Normalize (double length=1.0)
 Normalizes the vector to a specified length.
 
bool GetNormalized (TVector< Size, double > &result, double length=1.0) const
 Returns a normalized copy of this vector with specified length.
 
void GetMinimal (const TVector< Size, double > &vector, TVector< Size, double > &result) const
 Get vector with minimal elements values.
 
void GetMaximal (const TVector< Size, double > &vector, TVector< Size, double > &result) const
 Get vector with maximal elements values.
 
bool Serialize (iser::IArchive &archive)
 Serialize this vector to specified archive.
 
bool operator== (const TVector< Size, double > &vector) const
 
bool operator!= (const TVector< Size, double > &vector) const
 
bool operator< (const TVector< Size, double > &vector) const
 
bool operator> (const TVector< Size, double > &vector) const
 
bool operator<= (const TVector< Size, double > &vector) const
 
bool operator>= (const TVector< Size, double > &vector) const
 
TVector< Size, double > & operator= (const TVector< Size, double > &vector)=default
 
TVector< Size, double > operator- () const
 
TVector< Size, double > operator- (const TVector< Size, double > &vector) const
 
TVector< Size, double > operator+ (const TVector< Size, double > &vector) const
 
TVector< Size, double > operator* (double scalar) const
 
TVector< Size, double > operator/ (double scalar) const
 
TVector< Size, double > & operator+= (const TVector< Size, double > &vector)
 
TVector< Size, double > & operator-= (const TVector< Size, double > &vector)
 
TVector< Size, double > & operator*= (double scalar)
 
TVector< Size, double > & operator/= (double scalar)
 
const double & operator[] (int i) const
 
double & operator[] (int i)
 

Static Public Member Functions

static const CVector2dGetZero ()
 
- Static Public Member Functions inherited from imath::TVector< 2 >
static int GetElementsCount ()
 Get number of elements.
 
static bool SetElementsCount (int count)
 Set number of elements.
 
static const TVector< Size, double > & GetZero ()
 Get vector with all coordinates set to 0.
 

Additional Inherited Members

- Protected Attributes inherited from imath::TVector< 2 >
Elements m_elements
 

Detailed Description

Definition of position or mathematical vector on 2D plane.

Definition at line 28 of file CVector2d.h.

Member Typedef Documentation

◆ BaseClass

Definition at line 31 of file CVector2d.h.

Constructor & Destructor Documentation

◆ CVector2d() [1/5]

i2d::CVector2d::CVector2d ( )
inline

Default constructor.

Please note, elements will be not initialized.

Definition at line 147 of file CVector2d.h.

Referenced by GetHorizontalTranslated(), GetVerticalTranslated(), operator*(), operator+(), operator-(), operator-(), and operator/().

◆ CVector2d() [2/5]

i2d::CVector2d::CVector2d ( double  x,
double  y 
)
inline

Construct initializing elements to specified values.

Definition at line 152 of file CVector2d.h.

References imath::TVector< 2 >::operator[]().

◆ CVector2d() [3/5]

i2d::CVector2d::CVector2d ( const istd::CIndex2d index)
inline

◆ CVector2d() [4/5]

i2d::CVector2d::CVector2d ( const QPointF &  point)
inline

Definition at line 140 of file CVector2d.h.

References imath::TVector< 2 >::operator[]().

◆ CVector2d() [5/5]

i2d::CVector2d::CVector2d ( const imath::TVector< 2 > &  vector)
inline

Copy constructor.

Definition at line 159 of file CVector2d.h.

Member Function Documentation

◆ GetAngle()

double i2d::CVector2d::GetAngle ( ) const
inline

Get angle of this vector.

Definition at line 226 of file CVector2d.h.

References GetX(), and GetY().

◆ GetCrossProductZ()

double i2d::CVector2d::GetCrossProductZ ( const imath::TVector< 2 > &  vector) const
inline

Return Z coordinate of two vectors cross product.

Definition at line 214 of file CVector2d.h.

References GetX(), and GetY().

Referenced by i2d::CLine2d::GetAlphaAndCastDistance(), and i2d::CLine2d::GetCutAlpha().

◆ GetDotProduct()

double i2d::CVector2d::GetDotProduct ( const CVector2d vector) const
inline

Definition at line 220 of file CVector2d.h.

References GetX(), and GetY().

Referenced by i2d::CLine2d::GetAlphaAndCastDistance(), and i2d::CLine2d::GetCastAlpha().

◆ GetHorizontalTranslated()

CVector2d i2d::CVector2d::GetHorizontalTranslated ( double  offsetX) const
inline

Get horizontal translated point.

Definition at line 202 of file CVector2d.h.

References CVector2d(), GetX(), and GetY().

◆ GetNormalized()

CVector2d i2d::CVector2d::GetNormalized ( double  length = 1.0) const

Return normalized vector with the same direction and specified length.

◆ GetOrthogonal()

CVector2d i2d::CVector2d::GetOrthogonal ( ) const

Get orthogonal vector.

◆ GetTranslated()

CVector2d i2d::CVector2d::GetTranslated ( const imath::TVector< 2 > &  vector)
inline

Get translated point.

Definition at line 196 of file CVector2d.h.

◆ GetVerticalTranslated()

CVector2d i2d::CVector2d::GetVerticalTranslated ( double  offsetY) const
inline

Get vertical translated point.

Definition at line 208 of file CVector2d.h.

References CVector2d(), GetX(), and GetY().

◆ GetX()

double i2d::CVector2d::GetX ( ) const
inline

◆ GetY()

double i2d::CVector2d::GetY ( ) const
inline

◆ GetZero()

const CVector2d & i2d::CVector2d::GetZero ( )
inlinestatic

◆ Init()

void i2d::CVector2d::Init ( double  angle,
double  length = 1.0 
)

Init this vector using angle and vector length.

◆ operator QPointF()

i2d::CVector2d::operator QPointF ( ) const
inline

Definition at line 298 of file CVector2d.h.

◆ operator*()

CVector2d i2d::CVector2d::operator* ( double  scalar) const
inline

Definition at line 250 of file CVector2d.h.

References CVector2d(), GetX(), and GetY().

◆ operator*=()

CVector2d & i2d::CVector2d::operator*= ( double  scalar)
inline

Definition at line 282 of file CVector2d.h.

References imath::TVector< 2 >::operator*=().

◆ operator+()

CVector2d i2d::CVector2d::operator+ ( const imath::TVector< 2 > &  vector) const
inline

Definition at line 238 of file CVector2d.h.

References CVector2d(), GetX(), and GetY().

◆ operator+=()

CVector2d & i2d::CVector2d::operator+= ( const imath::TVector< 2 > &  vector)
inline

Definition at line 266 of file CVector2d.h.

References imath::TVector< 2 >::operator+=().

◆ operator-() [1/2]

CVector2d i2d::CVector2d::operator- ( ) const
inline

Definition at line 232 of file CVector2d.h.

References CVector2d(), GetX(), and GetY().

◆ operator-() [2/2]

CVector2d i2d::CVector2d::operator- ( const imath::TVector< 2 > &  vector) const
inline

Definition at line 244 of file CVector2d.h.

References CVector2d(), GetX(), and GetY().

◆ operator-=()

CVector2d & i2d::CVector2d::operator-= ( const imath::TVector< 2 > &  vector)
inline

Definition at line 274 of file CVector2d.h.

References imath::TVector< 2 >::operator-=().

◆ operator/()

CVector2d i2d::CVector2d::operator/ ( double  scalar) const
inline

Definition at line 256 of file CVector2d.h.

References CVector2d(), GetX(), GetY(), and I_BIG_EPSILON.

◆ operator/=()

CVector2d & i2d::CVector2d::operator/= ( double  scalar)
inline

Definition at line 290 of file CVector2d.h.

References imath::TVector< 2 >::operator/=().

◆ Serialize()

bool i2d::CVector2d::Serialize ( iser::IArchive archive)

Serialize this vector to specified archive.

◆ SetX()

void i2d::CVector2d::SetX ( double  x)
inline

Set X position of this vector.

Definition at line 178 of file CVector2d.h.

References imath::TVector< 2 >::operator[]().

Referenced by i2d::CMatrix2d::GetAxesLengths().

◆ SetY()

void i2d::CVector2d::SetY ( double  y)
inline

Set Y position of this vector.

Definition at line 190 of file CVector2d.h.

References imath::TVector< 2 >::operator[]().

Referenced by i2d::CMatrix2d::GetAxesLengths().

◆ ToIndex2d()

istd::CIndex2d i2d::CVector2d::ToIndex2d ( ) const

Get vector converted to 2D index.


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