Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Angles
[Primitives]


Detailed Description

Global functions to compute angles between vectors.
#include <qgarlib/primitives.H>


Global functions to compute angles between vectors

Warning:
 O
  +---------------> X
  |\    |
  | \ <-'
  |  \    angle (in radians unless specified)
  |   \
  |
  v

    Y
  • The origin of the coordinate system is at top left corner.
  • Angles are clockwise from the X axis.


template<class T>
double qgar::qgAngle (const GenPoint< T > &aPt1, const GenPoint< T > &aPt2)
 Angle (in [0, 2PI[ radians) between the X axis and the vector formed by the two given points.
template<class T>
double qgar::qgAngleDegrees (const GenPoint< T > &aPt1, const GenPoint< T > &aPt2)
 Same as qgar::qgAngle(const GenPoint<T>&, const GenPoint<T>&), but the result is given in [0, 360[ degrees.
template<class T>
double qgar::qgAngle (const GenPoint< T > &aPt1, const GenPoint< T > &aPt2, const GenPoint< T > &aPt3)
 Angle (in [0, 2PI[ radians) between two vectors determined by 3 points.
template<class T>
double qgar::qgAngleDegrees (const GenPoint< T > &aPt1, const GenPoint< T > &aPt2, const GenPoint< T > &aPt3)
 Same as qgar::qgAngle(const GenPoint<T>&,const GenPoint<T>&, const GenPoint<T>&), but the result is given in [0, 360[ degrees.
template<class T>
double qgar::qgAngle (const GenPoint< T > &aPt1, const GenPoint< T > &aPt2, const GenPoint< T > &aPt3, const GenPoint< T > &aPt4)
 Angle (in [0, 2PI[ radians) between two vectors determined by 4 points.
template<class T>
double qgar::qgAngleDegrees (const GenPoint< T > &aPt1, const GenPoint< T > &aPt2, const GenPoint< T > &aPt3, const GenPoint< T > &aPt4)
 Same as qgar::qgAngle(const GenPoint<T>&,const GenPoint<T>&, const GenPoint<T>&, const GenPoint<T>&), but the result is given in [0, 360[ degrees.
template<class T>
double qgar::qgSlope (const GenPoint< T > &aPt1, const GenPoint< T > &aPt2)
 Angle (in [0, PI[ radians) between the X axis and the segment formed by the two given points.
template<class T>
double qgar::qgSlopeDegrees (const GenPoint< T > &aPt1, const GenPoint< T > &aPt2)
 Same as qgar::qgSlope(const GenPoint<T>&, const GenPoint<T>&), but the result is given in [0, 180[ degrees.


Function Documentation

template<class T>
double qgar::qgAngle const GenPoint< T > &  aPt1,
const GenPoint< T > &  aPt2,
const GenPoint< T > &  aPt3,
const GenPoint< T > &  aPt4
 

Angle (in [0, 2PI[ radians) between two vectors determined by 4 points.

First vector is aPt1-->aPt2, second vector is aPt3-->aPt4.

 0
  +----------------------> X      +-------------------------> X
  |                               |    ----
  |                               |   /    \
  |        aPt1                   |   |     v  aPt3
  |    \----+------>+ aPt2        |   |  \-----+------>+ aPt4
  |     \     |                   |   \ __\   
  | aPt3 +    |                   |        \
  |       \<--'                   |         + aPt1
  |        \                      |          \
  |         v                     |           v   
  |          + aPt4               |            + aPt2
  v                               v

  Y                               Y

Parameters:
aPt1 a point
aPt2 a point
aPt3 a point
aPt4 a point

Definition at line 183 of file _QGAR_angle.TCC.

References qgar::Math::QG_2PI, and qgar::qgAngle().

template<class T>
double qgar::qgAngle const GenPoint< T > &  aPt1,
const GenPoint< T > &  aPt2,
const GenPoint< T > &  aPt3
[inline]
 

Angle (in [0, 2PI[ radians) between two vectors determined by 3 points.

First vector is aPt1-->aPt2, second vector is aPt1-->aPt3.

 0
  +---------------------> X      +---------------------> X
  |                              |    ----
  |                              |   /    \
  | aPt1                         |   |     v
  |   +--------->+ aPt2          |   |  +------->+ aPt3
  |    \    |                    |   \ __\   
  |     \ <-'                    |        \
  |      \                       |         \
  |       v                      |          v   
  |        + aPt3                |           + aPt2
  v                              v

  Y                              Y

Parameters:
aPt1 a point
aPt2 a point
aPt3 a point

Definition at line 136 of file _QGAR_angle.TCC.

References qgar::qgAngle().

template<class T>
double qgar::qgAngle const GenPoint< T > &  aPt1,
const GenPoint< T > &  aPt2
 

Angle (in [0, 2PI[ radians) between the X axis and the vector formed by the two given points.

                                        ----->/
 O                          O          /     /
  +---------------> X        +---------|-------------> X
  |    \    |                |         |   /  |
  |     \ <-' angle          |   angle \_ /__/
  |      \                   |           /
  |       + aPt1             |          + aPt2
  |        \                 |         ^
  |         \                |        /
  |          v               |       /
  v           + aPt2         v      + aPt1

  Y                          Y

Parameters:
aPt1 a point
aPt2 a point
Warning:
The vector orientation is first given point-->second given point.

Definition at line 91 of file _QGAR_angle.TCC.

References qgar::Math::QG_2PI.

Referenced by qgar::GenConvexHull< T >::PRIVATEgraham_sScan(), qgar::qgAngle(), qgar::qgAngleDegrees(), qgar::qgSlope(), qgar::RWArcVector::RWArcVector(), qgar::GenArc< T >::sourceAngle(), qgar::GenArc< T >::targetAngle(), and qgar::GenSegment< T >::theta().

template<class T>
double qgar::qgAngleDegrees const GenPoint< T > &  aPt1,
const GenPoint< T > &  aPt2,
const GenPoint< T > &  aPt3,
const GenPoint< T > &  aPt4
[inline]
 

Same as qgar::qgAngle(const GenPoint<T>&,const GenPoint<T>&, const GenPoint<T>&, const GenPoint<T>&), but the result is given in [0, 360[ degrees.

Definition at line 202 of file _QGAR_angle.TCC.

References qgar::qgAngle(), and qgar::qgRadiansToDegrees().

template<class T>
double qgar::qgAngleDegrees const GenPoint< T > &  aPt1,
const GenPoint< T > &  aPt2,
const GenPoint< T > &  aPt3
[inline]
 

Same as qgar::qgAngle(const GenPoint<T>&,const GenPoint<T>&, const GenPoint<T>&), but the result is given in [0, 360[ degrees.

Definition at line 148 of file _QGAR_angle.TCC.

References qgar::qgAngle(), and qgar::qgRadiansToDegrees().

template<class T>
double qgar::qgAngleDegrees const GenPoint< T > &  aPt1,
const GenPoint< T > &  aPt2
[inline]
 

Same as qgar::qgAngle(const GenPoint<T>&, const GenPoint<T>&), but the result is given in [0, 360[ degrees.

Parameters:
aPt1 a point
aPt2 a point

Definition at line 104 of file _QGAR_angle.TCC.

References qgar::qgAngle(), and qgar::qgRadiansToDegrees().

template<class T>
double qgar::qgSlope const GenPoint< T > &  aPt1,
const GenPoint< T > &  aPt2
 

Angle (in [0, PI[ radians) between the X axis and the segment formed by the two given points.

 O                          O
  +-----------------> X      +-----------------> X
  |    \    |                |    \    |
  |     \ <-' angle          |     \ <-' angle
  |      \                   |      \
  |       + aPt1             |       + aPt2
  |        \                 |        \
  |         \                |         \
  |          \               |          \
  v           + aPt2         v           + aPt1

  Y                          Y

Parameters:
aPt1 a point
aPt2 a point

Definition at line 236 of file _QGAR_angle.TCC.

References qgar::Math::QG_PI, and qgar::qgAngle().

Referenced by qgar::qgSlopeDegrees(), and qgar::GenSegment< T >::slope().

template<class T>
double qgar::qgSlopeDegrees const GenPoint< T > &  aPt1,
const GenPoint< T > &  aPt2
[inline]
 

Same as qgar::qgSlope(const GenPoint<T>&, const GenPoint<T>&), but the result is given in [0, 180[ degrees.

Definition at line 248 of file _QGAR_angle.TCC.

References qgar::qgRadiansToDegrees(), and qgar::qgSlope().