9 #ifndef MsiChart_Vector2D_h 10 #define MsiChart_Vector2D_h 13 #include "PDCHeader/PDCcmath" 20 template <
class T =
float>
29 TVector2D(
double iX,
double iY) :
x(static_cast<T>(iX)),
y(static_cast<T>(iY)){}
42 :
x(static_cast<T>(irEnd.
x - irStart.
x)),
y(static_cast<T>(irEnd.
y - irStart.
y)){}
51 :
x(static_cast<T>(irEnd.
x - irStart.
x)),
y(static_cast<T>(irEnd.
y - irStart.
y)){}
58 void Reset(T iX, T iY);
110 return x * x + y * y;
117 return (x * irVector.
x + y * irVector.
y);
124 return (x * irVector.
y - y * irVector.
x);
130 double lTemp = InnerProduct(irVector) / (std::sqrt(LengthSquared() * irVector.
LengthSquared()));
131 lTemp = (lTemp > 1.0f) ? 1.0f : lTemp;
132 lTemp = (lTemp < -1.0f) ? -1.0f : lTemp;
133 return std::acos(lTemp);
139 return std::sqrt(LengthSquared());
145 double lLength = Length();
146 x =
static_cast<T
>(x / lLength);
147 y =
static_cast<T
>(y / lLength);
Definition: Vector2D.h:21
TVector2D(const Point2D &irPoint)
Definition: Vector2D.h:34
void Reset(T iX, T iY)
Definition: Vector2D.h:100
T y
Y component of current vector.
Definition: Vector2D.h:94
void Normalize()
Normalize the current vector.
Definition: Vector2D.h:143
TVector2D(double iX, double iY)
Definition: Vector2D.h:29
TVector2D(const FPoint2D &irStart, const FPoint2D &irEnd)
Definition: Vector2D.h:50
TVector2D< float > Vector2D
Definition: Vector2D.h:96
double IncludedAngle(const TVector2D< T > &irVector) const
Definition: Vector2D.h:128
T Length() const
Definition: Vector2D.h:137
TVector2D< double > DVector2D
Definition: Vector2D.h:97
TVector2D(const Point2D &irStart, const Point2D &irEnd)
Definition: Vector2D.h:41
T LengthSquared() const
Definition: Vector2D.h:108
T x
X component of current vector.
Definition: Vector2D.h:93
T CrossProduct(const TVector2D< T > &irVector) const
Definition: Vector2D.h:122
T InnerProduct(const TVector2D< T > &irVector) const
Definition: Vector2D.h:115