Bromeon
Vectors/VectorAlgebra3D.hpp
Go to the documentation of this file.
00001 
00002 //
00003 // Thor C++ Library
00004 // Copyright (c) 2011 Jan Haller
00005 // 
00006 // This software is provided 'as-is', without any express or implied
00007 // warranty. In no event will the authors be held liable for any damages
00008 // arising from the use of this software.
00009 // 
00010 // Permission is granted to anyone to use this software for any purpose,
00011 // including commercial applications, and to alter it and redistribute it
00012 // freely, subject to the following restrictions:
00013 // 
00014 // 1. The origin of this software must not be misrepresented; you must not
00015 //    claim that you wrote the original software. If you use this software
00016 //    in a product, an acknowledgment in the product documentation would be
00017 //    appreciated but is not required.
00018 // 
00019 // 2. Altered source versions must be plainly marked as such, and must not be
00020 //    misrepresented as being the original software.
00021 // 
00022 // 3. This notice may not be removed or altered from any source distribution.
00023 //
00025 
00035 
00036 #ifndef THOR_VECTORALGEBRA3D_HPP
00037 #define THOR_VECTORALGEBRA3D_HPP
00038 
00039 #include <Thor/Math/Trigonometry.hpp>
00040 
00041 #include <SFML/System/Vector2.hpp>
00042 #include <SFML/System/Vector3.hpp>
00043 
00044 #include <cassert>
00045 
00046 
00047 namespace thor
00048 {
00049 
00052 
00055 template <typename T>
00056 T                           Length(const sf::Vector3<T>& vector);
00057 
00060 template <typename T>
00061 T                           SquaredLength(const sf::Vector3<T>& vector);
00062 
00065 template <typename T>
00066 sf::Vector3<T>              UnitVector(const sf::Vector3<T>& vector);
00067 
00072 template <typename T>
00073 T                           PolarAngle(const sf::Vector3<T>& vector);
00074 
00079 template <typename T>
00080 T                           ElevationAngle(const sf::Vector3<T>& vector);
00081 
00082 // ---------------------------------------------------------------------------------------------------------------------------
00083 
00084 
00087 template <typename T>
00088 T                           DotProduct(const sf::Vector3<T>& lhs, const sf::Vector3<T>& rhs);
00089 
00092 template <typename T>
00093 sf::Vector3<T>              CrossProduct(const sf::Vector3<T>& lhs, const sf::Vector3<T>& rhs);
00094 
00098 template <typename T>
00099 sf::Vector3<T>              ComponentwiseProduct(const sf::Vector3<T>& lhs, const sf::Vector3<T>& rhs);
00100 
00105 template <typename T>
00106 sf::Vector3<T>              ComponentwiseQuotient(const sf::Vector3<T>& lhs, const sf::Vector3<T>& rhs);
00107 
00108 // ---------------------------------------------------------------------------------------------------------------------------
00109 
00110 
00113 template <typename DestType, typename SourceType>
00114 sf::Vector3<DestType>       ConvertVector(const sf::Vector3<SourceType>& vector);
00115 
00118 template <typename T>
00119 sf::Vector3<T>              ToVector3(const sf::Vector2<T>& vector2);
00120 
00122 
00123 } // namespace thor
00124 
00125 #include <Thor/Detail/VectorAlgebra3D.inl>
00126 #endif // THOR_VECTORALGEBRA3D_HPP