Fix merge problems
Former-commit-id: 899b541adea1719f558c52abfab51458249b6aaf
This commit is contained in:
@@ -124,6 +124,7 @@ namespace Nz
|
||||
*
|
||||
* \param point Position of the point
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
bool Sphere<T>::Contains(const Vector3<T>& point) const
|
||||
{
|
||||
@@ -131,7 +132,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the distance from the center of the sphere to the point
|
||||
* \brief Returns the distance from the sphere to the point (is negative when the point is inside the sphere)
|
||||
* \return Distance to the point
|
||||
*
|
||||
* \param X X position of the point
|
||||
@@ -148,7 +149,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the distance from the center of the sphere to the point
|
||||
* \brief Returns the distance from the sphere to the point (is negative when the point is inside the sphere)
|
||||
* \return Distance to the point
|
||||
*
|
||||
* \param point Position of the point
|
||||
@@ -303,7 +304,7 @@ namespace Nz
|
||||
template<typename T>
|
||||
bool Sphere<T>::Intersect(const Sphere& sphere) const
|
||||
{
|
||||
return SquaredDistance(sphere.x, sphere.y, sphere.z) - radius * radius <= sphere.radius * sphere.radius;
|
||||
return SquaredDistance(sphere.x, sphere.y, sphere.z) <= sphere.radius * sphere.radius;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -392,7 +393,6 @@ namespace Nz
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*
|
||||
template<typename T>
|
||||
Sphere<T>& Sphere<T>::Set(const Circle<T>& circle)
|
||||
@@ -407,11 +407,12 @@ namespace Nz
|
||||
*/
|
||||
|
||||
/*!
|
||||
* \brief Sets the components of the sphere with center and radius from another sphere
|
||||
* \brief Sets the components of the sphere with center and radius from another
|
||||
* \return A reference to this sphere
|
||||
*
|
||||
* \param sphere The other sphere
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
Sphere<T>& Sphere<T>::Set(const Sphere& sphere)
|
||||
{
|
||||
@@ -458,7 +459,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the squared distance from the center of the sphere to the point
|
||||
* \brief Returns the squared distance from the sphere to the point (can be negative if the point is inside the sphere)
|
||||
* \return Squared distance to the point
|
||||
*
|
||||
* \param X X position of the point
|
||||
@@ -467,7 +468,6 @@ namespace Nz
|
||||
*
|
||||
* \see Distance
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T Sphere<T>::SquaredDistance(T X, T Y, T Z) const
|
||||
{
|
||||
@@ -475,14 +475,13 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Returns the squared distance from the center of the sphere to the point
|
||||
* \brief Returns the squared distance from the sphere to the point (can be negative if the point is inside the sphere)
|
||||
* \return Squared distance to the point
|
||||
*
|
||||
* \param point Position of the point
|
||||
*
|
||||
* \see Distance
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
T Sphere<T>::SquaredDistance(const Vector3<T>& point) const
|
||||
{
|
||||
|
||||
@@ -102,11 +102,6 @@ namespace Nz
|
||||
T x, y;
|
||||
};
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Vector2<T>& vec);
|
||||
|
||||
template<typename T> Vector2<T> operator*(T scale, const Vector2<T>& vec);
|
||||
template<typename T> Vector2<T> operator/(T scale, const Vector2<T>& vec);
|
||||
|
||||
typedef Vector2<double> Vector2d;
|
||||
typedef Vector2<float> Vector2f;
|
||||
typedef Vector2<int> Vector2i;
|
||||
@@ -118,6 +113,11 @@ namespace Nz
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector2<T>* vector);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector2<T>& vec);
|
||||
|
||||
template<typename T> Nz::Vector2<T> operator*(T scale, const Nz::Vector2<T>& vec);
|
||||
template<typename T> Nz::Vector2<T> operator/(T scale, const Nz::Vector2<T>& vec);
|
||||
|
||||
#include <Nazara/Math/Vector2.inl>
|
||||
|
||||
#endif // NAZARA_VECTOR2_HPP
|
||||
|
||||
@@ -124,11 +124,6 @@ namespace Nz
|
||||
T x, y, z;
|
||||
};
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Vector3<T>& vec);
|
||||
|
||||
template<typename T> Vector3<T> operator*(T scale, const Vector3<T>& vec);
|
||||
template<typename T> Vector3<T> operator/(T scale, const Vector3<T>& vec);
|
||||
|
||||
typedef Vector3<double> Vector3d;
|
||||
typedef Vector3<float> Vector3f;
|
||||
typedef Vector3<int> Vector3i;
|
||||
@@ -140,6 +135,11 @@ namespace Nz
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector3<T>* vector);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector3<T>& vec);
|
||||
|
||||
template<typename T> Nz::Vector3<T> operator*(T scale, const Nz::Vector3<T>& vec);
|
||||
template<typename T> Nz::Vector3<T> operator/(T scale, const Nz::Vector3<T>& vec);
|
||||
|
||||
#include <Nazara/Math/Vector3.inl>
|
||||
|
||||
#endif // NAZARA_VECTOR3_HPP
|
||||
|
||||
@@ -1012,10 +1012,15 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shorthand for the vector (0, -1, 0)
|
||||
* \return A vector with components (0, -1, 0)
|
||||
* \brief Measure the distance between two points
|
||||
* Shorthand for vec1.Distance(vec2)
|
||||
*
|
||||
* \see MakeDown
|
||||
* param vec1 the first point
|
||||
* param vec2 the second point
|
||||
*
|
||||
* \return The distance between the two vectors
|
||||
*
|
||||
* \see SquaredDistance
|
||||
*/
|
||||
template<typename T>
|
||||
T Vector3<T>::Distance(const Vector3& vec1, const Vector3& vec2)
|
||||
@@ -1023,12 +1028,29 @@ namespace Nz
|
||||
return vec1.Distance(vec2);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Measure the distance between two points as a float
|
||||
* Shorthand for vec1.Distancef(vec2)
|
||||
*
|
||||
* param vec1 the first point
|
||||
* param vec2 the second point
|
||||
*
|
||||
* \return The distance between the two vectors as a float
|
||||
*
|
||||
* \see SquaredDistancef
|
||||
*/
|
||||
template<typename T>
|
||||
float Vector3<T>::Distancef(const Vector3& vec1, const Vector3& vec2)
|
||||
{
|
||||
return vec1.Distancef(vec2);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shorthand for the vector (0, -1, 0)
|
||||
* \return A vector with components (0, -1, 0)
|
||||
*
|
||||
* \see MakeDown
|
||||
*/
|
||||
template<typename T>
|
||||
Vector3<T> Vector3<T>::Down()
|
||||
{
|
||||
@@ -1123,10 +1145,13 @@ namespace Nz
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shorthand for the vector (1, 1, 1)
|
||||
* \return A vector with components (1, 1, 1)
|
||||
* \brief Calculates the squared distance between two vectors
|
||||
* \return The metric distance between two vectors with the squared euclidean norm
|
||||
*
|
||||
* \see MakeUnit
|
||||
* \param vec1 The first point to measure the distance with
|
||||
* \param vec2 The second point to measure the distance with
|
||||
*
|
||||
* \see Distance
|
||||
*/
|
||||
template<typename T>
|
||||
T Vector3<T>::SquaredDistance(const Vector3& vec1, const Vector3& vec2)
|
||||
@@ -1134,6 +1159,12 @@ namespace Nz
|
||||
return vec1.SquaredDistance(vec2);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Shorthand for the vector (1, 1, 1)
|
||||
* \return A vector with components (1, 1, 1)
|
||||
*
|
||||
* \see MakeUnit
|
||||
*/
|
||||
template<typename T>
|
||||
Vector3<T> Vector3<T>::Unit()
|
||||
{
|
||||
@@ -1312,6 +1343,8 @@ Nz::Vector3<T> operator/(T scale, const Nz::Vector3<T>& vec)
|
||||
throw std::domain_error(error);
|
||||
}
|
||||
#endif
|
||||
|
||||
return Nz::Vector3<T>(scale / vec.x, scale / vec.y, scale / vec.z);
|
||||
}
|
||||
|
||||
#undef F
|
||||
|
||||
@@ -100,11 +100,6 @@ namespace Nz
|
||||
T x, y, z, w;
|
||||
};
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Vector4<T>& vec);
|
||||
|
||||
template<typename T> Vector4<T> operator*(T scale, const Vector4<T>& vec);
|
||||
template<typename T> Vector4<T> operator/(T scale, const Vector4<T>& vec);
|
||||
|
||||
typedef Vector4<double> Vector4d;
|
||||
typedef Vector4<float> Vector4f;
|
||||
typedef Vector4<int> Vector4i;
|
||||
@@ -116,6 +111,11 @@ namespace Nz
|
||||
template<typename T> bool Unserialize(SerializationContext& context, Vector4<T>* vector);
|
||||
}
|
||||
|
||||
template<typename T> std::ostream& operator<<(std::ostream& out, const Nz::Vector4<T>& vec);
|
||||
|
||||
template<typename T> Nz::Vector4<T> operator*(T scale, const Nz::Vector4<T>& vec);
|
||||
template<typename T> Nz::Vector4<T> operator/(T scale, const Nz::Vector4<T>& vec);
|
||||
|
||||
#include <Nazara/Math/Vector4.inl>
|
||||
|
||||
#endif // NAZARA_VECTOR4_HPP
|
||||
|
||||
@@ -1116,6 +1116,8 @@ Nz::Vector4<T> operator/(T scale, const Nz::Vector4<T>& vec)
|
||||
throw std::domain_error(error);
|
||||
}
|
||||
#endif
|
||||
|
||||
return Nz::Vector4<T>(scale / vec.x, scale / vec.y, scale / vec.z, scale / vec.w);
|
||||
}
|
||||
|
||||
#undef F
|
||||
|
||||
Reference in New Issue
Block a user