WSM API v25.0.0 (2025.0.0)
Loading...
Searching...
No Matches
WSM::Vector2d Class Reference

Description

The Vector2d class stores a vector in 2D space.

The coordinates of the vector are accessed via public data members, x and y, or via the subscript operator, where indices 0 and 1 denote the x- and y- coordinates, respectively.

The operator '*' is the cross product of vectors, the operator '' is the dot product.

#include <Vector2d.h>

Public Member Functions

 Vector2d ()
 
 Vector2d (double xx, double yy)
 
Vector2d operator+ (const Vector2d &v) const
 
Vector2d operator- (const Vector2d &v) const
 
double operator% (const Vector2d &v) const
 
Vector2d operator- () const
 
Vector2d operator* (double scalar) const
 
Vector2d operator/ (double scalar) const
 
double operator[] (size_t index) const
 
double & operator[] (size_t index)
 
double length () const
 
double lengthSqrd () const
 
double lengthRect () const
 
Vector2dnormalize (double epsSqrd=WSM_MACHINE_TOL2)
 
Vector2d getNormalized (double epsSqrd=WSM_MACHINE_TOL2) const
 
double dist (const Vector2d &v) const
 
double distSqrd (const Vector2d &v) const
 
double distRect (const Vector2d &v) const
 
bool isEqual (const Vector2d &v, double epsSqrd=WSM_DISTANCE_TOL2) const
 
bool isEqualRect (const Vector2d &v, double epsRect=WSM_DISTANCE_TOL) const
 
bool isExactNull () const
 
bool isParallel (const Vector2d &, double epsNorSqrd=WSM_ANGLE_TOL2) const
 
bool isPerpend (const Vector2d &, double epsNor=WSM_ANGLE_TOL) const
 
void operator+= (const Vector2d &v)
 
void operator-= (const Vector2d &v)
 
void operator*= (double scalar)
 
void operator/= (double scalar)
 
Vector2d perpend () const
 
double angle (const Vector2d &, double epsNor=WSM_ANGLE_TOL) const
 
double angleBetweenNormalized (const Vector2d &aV, double epsNor=WSM_ANGLE_TOL) const
 
bool isNull (double epsSqrd=WSM_DISTANCE_TOL2) const
 
Vector2dset (double xx, double yy)
 
Vector2dzero ()
 
Vector2dscale (const Vector2d &v)
 
Vector2d getScaled (const Vector2d &v) const
 

Static Public Member Functions

static double det (const Vector2d &v1, const Vector2d &v2)
 det function.
 

Public Attributes

double x
 
double y
 

Static Public Attributes

static const Vector2d kNull
 
static const Vector2d kXDir
 
static const Vector2d kYDir
 

Constructor & Destructor Documentation

◆ Vector2d() [1/2]

WSM::Vector2d::Vector2d ( )
inline

◆ Vector2d() [2/2]

WSM::Vector2d::Vector2d ( double  xx,
double  yy 
)
inline

Member Function Documentation

◆ angle()

double WSM::Vector2d::angle ( const Vector2d ,
double  epsNor = WSM_ANGLE_TOL 
) const

◆ angleBetweenNormalized()

double WSM::Vector2d::angleBetweenNormalized ( const Vector2d aV,
double  epsNor = WSM_ANGLE_TOL 
) const

◆ det()

static double WSM::Vector2d::det ( const Vector2d v1,
const Vector2d v2 
)
inlinestatic

det function.

Parameters
[in]v1
[in]v2

◆ dist()

double WSM::Vector2d::dist ( const Vector2d v) const
inline

◆ distRect()

double WSM::Vector2d::distRect ( const Vector2d v) const
inline

◆ distSqrd()

double WSM::Vector2d::distSqrd ( const Vector2d v) const
inline

◆ getNormalized()

Vector2d WSM::Vector2d::getNormalized ( double  epsSqrd = WSM_MACHINE_TOL2) const

◆ getScaled()

Vector2d WSM::Vector2d::getScaled ( const Vector2d v) const
inline

◆ isEqual()

bool WSM::Vector2d::isEqual ( const Vector2d v,
double  epsSqrd = WSM_DISTANCE_TOL2 
) const
inline

◆ isEqualRect()

bool WSM::Vector2d::isEqualRect ( const Vector2d v,
double  epsRect = WSM_DISTANCE_TOL 
) const
inline

◆ isExactNull()

bool WSM::Vector2d::isExactNull ( ) const
inline

◆ isNull()

bool WSM::Vector2d::isNull ( double  epsSqrd = WSM_DISTANCE_TOL2) const
inline

◆ isParallel()

bool WSM::Vector2d::isParallel ( const Vector2d ,
double  epsNorSqrd = WSM_ANGLE_TOL2 
) const

◆ isPerpend()

bool WSM::Vector2d::isPerpend ( const Vector2d ,
double  epsNor = WSM_ANGLE_TOL 
) const

◆ length()

double WSM::Vector2d::length ( ) const
inline

◆ lengthRect()

double WSM::Vector2d::lengthRect ( ) const
inline

◆ lengthSqrd()

double WSM::Vector2d::lengthSqrd ( ) const
inline

◆ normalize()

Vector2d & WSM::Vector2d::normalize ( double  epsSqrd = WSM_MACHINE_TOL2)

◆ operator%()

double WSM::Vector2d::operator% ( const Vector2d v) const
inline

◆ operator*()

Vector2d WSM::Vector2d::operator* ( double  scalar) const
inline

◆ operator*=()

void WSM::Vector2d::operator*= ( double  scalar)
inline

◆ operator+()

Vector2d WSM::Vector2d::operator+ ( const Vector2d v) const
inline

◆ operator+=()

void WSM::Vector2d::operator+= ( const Vector2d v)
inline

◆ operator-() [1/2]

Vector2d WSM::Vector2d::operator- ( ) const
inline

◆ operator-() [2/2]

Vector2d WSM::Vector2d::operator- ( const Vector2d v) const
inline

◆ operator-=()

void WSM::Vector2d::operator-= ( const Vector2d v)
inline

◆ operator/()

Vector2d WSM::Vector2d::operator/ ( double  scalar) const
inline

◆ operator/=()

void WSM::Vector2d::operator/= ( double  scalar)
inline

◆ operator[]() [1/2]

double & WSM::Vector2d::operator[] ( size_t  index)
inline

◆ operator[]() [2/2]

double WSM::Vector2d::operator[] ( size_t  index) const
inline

◆ perpend()

Vector2d WSM::Vector2d::perpend ( ) const
inline

◆ scale()

Vector2d & WSM::Vector2d::scale ( const Vector2d v)
inline

◆ set()

Vector2d & WSM::Vector2d::set ( double  xx,
double  yy 
)
inline

◆ zero()

Vector2d & WSM::Vector2d::zero ( )
inline

Member Data Documentation

◆ kNull

const Vector2d WSM::Vector2d::kNull
static

◆ kXDir

const Vector2d WSM::Vector2d::kXDir
static

◆ kYDir

const Vector2d WSM::Vector2d::kYDir
static

◆ x

double WSM::Vector2d::x

◆ y

double WSM::Vector2d::y

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