Public Member Functions | Static Public Member Functions | List of all members
i2d::CDirection2d Class Reference

Represents a direction in 2D space. More...

#include <CDirection2d.h>

Public Member Functions

 CDirection2d ()
 
 CDirection2d (const CDirection2d &direction)
 Construct a new object by copy. More...
 
 CDirection2d (double radian)
 Construct a new object from radian coordinates. More...
 
 CDirection2d (const CVector2d &direction)
 Construct direction using angle of vector. More...
 
double ToDegree () const
 Get direction in degrees. More...
 
double ToRadian () const
 Get direction in radians. More...
 
double DistInRadian (const CDirection2d &dir2) const
 Get angle difference in radians. More...
 
double DistInDegree (const CDirection2d &dir2) const
 Get angle difference in degrees. More...
 
CDirection2d Avg (const CDirection2d &dir2) const
 Get minimal distance between two directions. More...
 
CDirection2d Avg (double weight, const CDirection2d &dir2) const
 Get weighted minimal distance between two directions. More...
 
CDirection2d TurnByRadian (double turn) const
 
bool operator== (const CDirection2d &dir2) const
 Compare the objects direction with the one of dir2. More...
 
bool IsInRange (const CDirection2d &leftDirectionLimit, const CDirection2d &rightDirectionLimit) const
 Check if the direction is in the direction range between leftDirectionLimit and rightDirectionLimit. More...
 

Static Public Member Functions

static CDirection2d FromRadian (double radian)
 Construct a new CDirection2d object and initialize from radian. More...
 
static CDirection2d FromDegree (double degree)
 Construct a new CDirection2d object and initialize from degree. More...
 

Detailed Description

Represents a direction in 2D space.

Definition at line 15 of file CDirection2d.h.

Constructor & Destructor Documentation

i2d::CDirection2d::CDirection2d ( )
i2d::CDirection2d::CDirection2d ( const CDirection2d direction)

Construct a new object by copy.

i2d::CDirection2d::CDirection2d ( double  radian)
explicit

Construct a new object from radian coordinates.

Parameters
radianangle in radians.
i2d::CDirection2d::CDirection2d ( const CVector2d direction)

Construct direction using angle of vector.

Member Function Documentation

CDirection2d i2d::CDirection2d::Avg ( const CDirection2d dir2) const

Get minimal distance between two directions.

Returns
Direction that minimizes the distance to this and dir2.
CDirection2d i2d::CDirection2d::Avg ( double  weight,
const CDirection2d dir2 
) const

Get weighted minimal distance between two directions.

Returns
Direction that minimizes the weighted distances between both directions.
double i2d::CDirection2d::DistInDegree ( const CDirection2d dir2) const

Get angle difference in degrees.

Returns
Minimal angle distance between the this and dir2 directions in degree [0, +180].
double i2d::CDirection2d::DistInRadian ( const CDirection2d dir2) const

Get angle difference in radians.

Returns
Minimal angle distance between the this and dir2 directions in radians [0, +PI].
static CDirection2d i2d::CDirection2d::FromDegree ( double  degree)
static

Construct a new CDirection2d object and initialize from degree.

static CDirection2d i2d::CDirection2d::FromRadian ( double  radian)
static

Construct a new CDirection2d object and initialize from radian.

bool i2d::CDirection2d::IsInRange ( const CDirection2d leftDirectionLimit,
const CDirection2d rightDirectionLimit 
) const

Check if the direction is in the direction range between leftDirectionLimit and rightDirectionLimit.

bool i2d::CDirection2d::operator== ( const CDirection2d dir2) const

Compare the objects direction with the one of dir2.

Parameters
dir2direction to compare.
Returns
true if both are equal.
double i2d::CDirection2d::ToDegree ( ) const

Get direction in degrees.

Returns
Normalized direction in range [0, 360).
double i2d::CDirection2d::ToRadian ( ) const

Get direction in radians.

Returns
Normalized direction in range [-PI, +PI].
CDirection2d i2d::CDirection2d::TurnByRadian ( double  turn) const

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

© 2007-2017 Witold Gantzke and Kirill Lepskiy