ICF 3.1.1.10
Technical documentation of ICF Libraries
CDirection2d.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9namespace i2d
10{
11
12
13class CVector2d;
14
15
20{
21public:
23
27 CDirection2d(const CDirection2d& direction);
28
33 explicit CDirection2d(double radian);
34
38 CDirection2d(const CVector2d& direction);
39
43 static CDirection2d FromRadian(double radian);
44
48 static CDirection2d FromDegree(double degree);
49
54 double ToDegree() const;
55
60 double ToRadian() const;
61
66 double DistInRadian(const CDirection2d& dir2) const;
67
72 double DistInDegree(const CDirection2d& dir2) const;
73
78 CDirection2d Avg(const CDirection2d& dir2) const;
79
84 CDirection2d Avg(double weight, const CDirection2d& dir2) const;
85
86 CDirection2d TurnByRadian(double turn) const;
87
93 bool operator==(const CDirection2d& dir2) const;
94
98 bool IsInRange(const CDirection2d& leftDirectionLimit, const CDirection2d& rightDirectionLimit) const;
99
100private:
105 bool Invariant() const;
106
110 static double Normalize(double radian);
111
115 double m_direction;
116};
117
118
119} // namespace i2d
120
121
Represents a direction in 2D space.
double ToDegree() const
Get direction in degrees.
double DistInRadian(const CDirection2d &dir2) const
Get angle difference in radians.
CDirection2d(const CDirection2d &direction)
Construct a new object by copy.
static CDirection2d FromRadian(double radian)
Construct a new CDirection2d object and initialize from radian.
bool operator==(const CDirection2d &dir2) const
Compare the objects direction with the one of dir2.
bool IsInRange(const CDirection2d &leftDirectionLimit, const CDirection2d &rightDirectionLimit) const
Check if the direction is in the direction range between leftDirectionLimit and rightDirectionLimit.
CDirection2d Avg(double weight, const CDirection2d &dir2) const
Get weighted minimal distance between two directions.
CDirection2d Avg(const CDirection2d &dir2) const
Get minimal distance between two directions.
CDirection2d TurnByRadian(double turn) const
double ToRadian() const
Get direction in radians.
CDirection2d(double radian)
Construct a new object from radian coordinates.
static CDirection2d FromDegree(double degree)
Construct a new CDirection2d object and initialize from degree.
CDirection2d(const CVector2d &direction)
Construct direction using angle of vector.
double DistInDegree(const CDirection2d &dir2) const
Get angle difference in degrees.
Definition of position or mathematical vector on 2D plane.
Definition CVector2d.h:29
Contains the 2D objects.
Definition CAffine2d.h:15

© Witold Gantzke and Kirill Lepskiy