Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00025
00042
00043 #ifndef THOR_VECTORALGEBRA2D_HPP
00044 #define THOR_VECTORALGEBRA2D_HPP
00045
00046 #include <Thor/Math/Trigonometry.hpp>
00047
00048 #include <SFML/System/Vector2.hpp>
00049 #include <SFML/System/Vector3.hpp>
00050
00051 #include <cassert>
00052
00053
00054 namespace thor
00055 {
00056
00059
00062 template <typename T>
00063 T Length(const sf::Vector2<T>& vector);
00064
00067 template <typename T>
00068 T SquaredLength(const sf::Vector2<T>& vector);
00069
00073 template <typename T>
00074 void SetLength(sf::Vector2<T>& vector, T newLength);
00075
00078 template <typename T>
00079 sf::Vector2<T> UnitVector(const sf::Vector2<T>& vector);
00080
00085 template <typename T>
00086 T PolarAngle(const sf::Vector2<T>& vector);
00087
00090 template <typename T>
00091 void SetPolarAngle(sf::Vector2<T>& vector, T newAngle);
00092
00095 template <typename T>
00096 void Rotate(sf::Vector2<T>& vector, T angle);
00097
00100 template <typename T>
00101 sf::Vector2<T> RotatedVector(const sf::Vector2<T>& vector, T angle);
00102
00106 template <typename T>
00107 sf::Vector2<T> PerpendicularVector(const sf::Vector2<T>& vector);
00108
00109
00110
00111
00116 template <typename T>
00117 T Angle(const sf::Vector2<T>& lhs, const sf::Vector2<T>& rhs);
00118
00121 template <typename T>
00122 T DotProduct(const sf::Vector2<T>& lhs, const sf::Vector2<T>& rhs);
00123
00127 template <typename T>
00128 sf::Vector3<T> CrossProduct(const sf::Vector2<T>& lhs, const sf::Vector2<T>& rhs);
00129
00132 template <typename T>
00133 sf::Vector2<T> ComponentwiseProduct(const sf::Vector2<T>& lhs, const sf::Vector2<T>& rhs);
00134
00138 template <typename T>
00139 sf::Vector2<T> ComponentwiseQuotient(const sf::Vector2<T>& lhs, const sf::Vector2<T>& rhs);
00140
00141
00142
00143
00146 template <typename DestType, typename SourceType>
00147 sf::Vector2<DestType> ConvertVector(const sf::Vector2<SourceType>& vector);
00148
00150
00151 }
00152
00153 #include <Thor/Detail/VectorAlgebra2D.inl>
00154 #endif // THOR_VECTORALGEBRA2D_HPP