]> git.sesse.net Git - casparcg/blobdiff - dependencies64/sfml/include/SFML/System/Vector3.hpp
Updated some libraries to newer versions and/or versions compiled for vc12 (freeimage...
[casparcg] / dependencies64 / sfml / include / SFML / System / Vector3.hpp
index 216443ca7f04a3461bfb2a4152cbecbaa936711d..28d0c07603126233f95ae5127e0a52fef09bc539 100644 (file)
@@ -1,7 +1,7 @@
 ////////////////////////////////////////////////////////////
 //
 // SFML - Simple and Fast Multimedia Library
-// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)
+// Copyright (C) 2007-2014 Laurent Gomila (laurent.gom@gmail.com)
 //
 // This software is provided 'as-is', without any express or implied warranty.
 // In no event will the authors be held liable for any damages arising from the use of this software.
 namespace sf
 {
 ////////////////////////////////////////////////////////////
-/// Vector3 is an utility class for manipulating 3 dimensional
-/// vectors. Template parameter defines the type of coordinates
-/// (integer, float, ...)
+/// \brief Utility template class for manipulating
+///        3-dimensional vectors
+///
 ////////////////////////////////////////////////////////////
 template <typename T>
 class Vector3
 {
-public :
+public:
 
     ////////////////////////////////////////////////////////////
-    /// Default constructor
+    /// \brief Default constructor
+    ///
+    /// Creates a Vector3(0, 0, 0).
     ///
     ////////////////////////////////////////////////////////////
     Vector3();
 
     ////////////////////////////////////////////////////////////
-    /// Construct the vector from its coordinates
+    /// \brief Construct the vector from its coordinates
     ///
-    /// \param X X coordinate
-    /// \param Y Y coordinate
-    /// \param Z Z coordinate
+    /// \param X X coordinate
+    /// \param Y Y coordinate
+    /// \param Z Z coordinate
     ///
     ////////////////////////////////////////////////////////////
     Vector3(T X, T Y, T Z);
 
+    ////////////////////////////////////////////////////////////
+    /// \brief Construct the vector from another type of vector
+    ///
+    /// This constructor doesn't replace the copy constructor,
+    /// it's called only when U != T.
+    /// A call to this constructor will fail to compile if U
+    /// is not convertible to T.
+    ///
+    /// \param vector Vector to convert
+    ///
+    ////////////////////////////////////////////////////////////
+    template <typename U>
+    explicit Vector3(const Vector3<U>& vector);
+
     ////////////////////////////////////////////////////////////
     // Member data
     ////////////////////////////////////////////////////////////
@@ -63,147 +79,175 @@ public :
 };
 
 ////////////////////////////////////////////////////////////
-/// Operator - overload ; returns the opposite of a vector
+/// \relates Vector3
+/// \brief Overload of unary operator -
 ///
-/// \param V : Vector to negate
+/// \param left Vector to negate
 ///
-/// \return -V
+/// \return Memberwise opposite of the vector
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T> operator -(const Vector3<T>& V);
+Vector3<T> operator -(const Vector3<T>& left);
 
 ////////////////////////////////////////////////////////////
-/// Operator += overload ; add two vectors and assign to the first op
+/// \relates Vector3
+/// \brief Overload of binary operator +=
+///
+/// This operator performs a memberwise addition of both vectors,
+/// and assigns the result to \a left.
 ///
-/// \param V1 : First vector
-/// \param V2 : Second vector
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a vector)
 ///
-/// \return V1 + V2
+/// \return Reference to \a left
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T>& operator +=(Vector3<T>& V1, const Vector3<T>& V2);
+Vector3<T>& operator +=(Vector3<T>& left, const Vector3<T>& right);
 
 ////////////////////////////////////////////////////////////
-/// Operator -= overload ; subtract two vectors and assign to the first op
+/// \relates Vector3
+/// \brief Overload of binary operator -=
 ///
-/// \param V1 : First vector
-/// \param V2 : Second vector
+/// This operator performs a memberwise subtraction of both vectors,
+/// and assigns the result to \a left.
 ///
-/// \return V1 - V2
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a vector)
+///
+/// \return Reference to \a left
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T>& operator -=(Vector3<T>& V1, const Vector3<T>& V2);
+Vector3<T>& operator -=(Vector3<T>& left, const Vector3<T>& right);
 
 ////////////////////////////////////////////////////////////
-/// Operator + overload ; adds two vectors
+/// \relates Vector3
+/// \brief Overload of binary operator +
 ///
-/// \param V1 : First vector
-/// \param V2 : Second vector
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a vector)
 ///
-/// \return V1 + V2
+/// \return Memberwise addition of both vectors
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T> operator +(const Vector3<T>& V1, const Vector3<T>& V2);
+Vector3<T> operator +(const Vector3<T>& left, const Vector3<T>& right);
 
 ////////////////////////////////////////////////////////////
-/// Operator - overload ; subtracts two vectors
+/// \relates Vector3
+/// \brief Overload of binary operator -
 ///
-/// \param V1 : First vector
-/// \param V2 : Second vector
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a vector)
 ///
-/// \return V1 - V2
+/// \return Memberwise subtraction of both vectors
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T> operator -(const Vector3<T>& V1, const Vector3<T>& V2);
+Vector3<T> operator -(const Vector3<T>& left, const Vector3<T>& right);
 
 ////////////////////////////////////////////////////////////
-/// Operator * overload ; multiply a vector by a scalar value
+/// \relates Vector3
+/// \brief Overload of binary operator *
 ///
-/// \param V : Vector
-/// \param X : Scalar value
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a scalar value)
 ///
-/// \return V * X
+/// \return Memberwise multiplication by \a right
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T> operator *(const Vector3<T>& V, T X);
+Vector3<T> operator *(const Vector3<T>& left, T right);
 
 ////////////////////////////////////////////////////////////
-/// Operator * overload ; multiply a scalar value by a vector
+/// \relates Vector3
+/// \brief Overload of binary operator *
 ///
-/// \param X : Scalar value
-/// \param V : Vector
+/// \param left  Left operand (a scalar value)
+/// \param right Right operand (a vector)
 ///
-/// \return X * V
+/// \return Memberwise multiplication by \a left
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T> operator *(T X, const Vector3<T>& V);
+Vector3<T> operator *(T left, const Vector3<T>& right);
 
 ////////////////////////////////////////////////////////////
-/// Operator *= overload ; multiply-assign a vector by a scalar value
+/// \relates Vector3
+/// \brief Overload of binary operator *=
+///
+/// This operator performs a memberwise multiplication by \a right,
+/// and assigns the result to \a left.
 ///
-/// \param V : Vector
-/// \param X : Scalar value
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a scalar value)
 ///
-/// \return V * X
+/// \return Reference to \a left
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T>& operator *=(Vector3<T>& V, T X);
+Vector3<T>& operator *=(Vector3<T>& left, T right);
 
 ////////////////////////////////////////////////////////////
-/// Operator / overload ; divide a vector by a scalar value
+/// \relates Vector3
+/// \brief Overload of binary operator /
 ///
-/// \param V : Vector
-/// \param X : Scalar value
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a scalar value)
 ///
-/// \return V / X
+/// \return Memberwise division by \a right
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T> operator /(const Vector3<T>& V, T X);
+Vector3<T> operator /(const Vector3<T>& left, T right);
 
 ////////////////////////////////////////////////////////////
-/// Operator /= overload ; divide-assign a vector by a scalar value
+/// \relates Vector3
+/// \brief Overload of binary operator /=
 ///
-/// \param V : Vector
-/// \param X : Scalar value
+/// This operator performs a memberwise division by \a right,
+/// and assigns the result to \a left.
 ///
-/// \return V / X
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a scalar value)
+///
+/// \return Reference to \a left
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-Vector3<T>& operator /=(Vector3<T>& V, T X);
+Vector3<T>& operator /=(Vector3<T>& left, T right);
 
 ////////////////////////////////////////////////////////////
-/// Operator == overload ; compares the equality of two vectors
+/// \relates Vector3
+/// \brief Overload of binary operator ==
+///
+/// This operator compares strict equality between two vectors.
 ///
-/// \param V1 : First vector
-/// \param V2 : Second vector
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a vector)
 ///
-/// \return True if V1 is equal to V2
+/// \return True if \a left is equal to \a right
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-bool operator ==(const Vector3<T>& V1, const Vector3<T>& V2);
+bool operator ==(const Vector3<T>& left, const Vector3<T>& right);
 
 ////////////////////////////////////////////////////////////
-/// Operator != overload ; compares the difference of two vectors
+/// \relates Vector3
+/// \brief Overload of binary operator !=
+///
+/// This operator compares strict difference between two vectors.
 ///
-/// \param V1 : First vector
-/// \param V2 : Second vector
+/// \param left  Left operand (a vector)
+/// \param right Right operand (a vector)
 ///
-/// \return True if V1 is different than V2
+/// \return True if \a left is not equal to \a right
 ///
 ////////////////////////////////////////////////////////////
 template <typename T>
-bool operator !=(const Vector3<T>& V1, const Vector3<T>& V2);
+bool operator !=(const Vector3<T>& left, const Vector3<T>& right);
 
 #include <SFML/System/Vector3.inl>
 
@@ -215,3 +259,44 @@ typedef Vector3<float> Vector3f;
 
 
 #endif // SFML_VECTOR3_HPP
+
+
+////////////////////////////////////////////////////////////
+/// \class sf::Vector3
+/// \ingroup system
+///
+/// sf::Vector3 is a simple class that defines a mathematical
+/// vector with three coordinates (x, y and z). It can be used to
+/// represent anything that has three dimensions: a size, a point,
+/// a velocity, etc.
+///
+/// The template parameter T is the type of the coordinates. It
+/// can be any type that supports arithmetic operations (+, -, /, *)
+/// and comparisons (==, !=), for example int or float.
+///
+/// You generally don't have to care about the templated form (sf::Vector3<T>),
+/// the most common specializations have special typedefs:
+/// \li sf::Vector3<float> is sf::Vector3f
+/// \li sf::Vector3<int> is sf::Vector3i
+///
+/// The sf::Vector3 class has a small and simple interface, its x and y members
+/// can be accessed directly (there are no accessors like setX(), getX()) and it
+/// contains no mathematical function like dot product, cross product, length, etc.
+///
+/// Usage example:
+/// \code
+/// sf::Vector3f v1(16.5f, 24.f, -8.2f);
+/// v1.x = 18.2f;
+/// float y = v1.y;
+/// float z = v1.z;
+///
+/// sf::Vector3f v2 = v1 * 5.f;
+/// sf::Vector3f v3;
+/// v3 = v1 + v2;
+///
+/// bool different = (v2 != v3);
+/// \endcode
+///
+/// Note: for 2-dimensional vectors, see sf::Vector2.
+///
+////////////////////////////////////////////////////////////