summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/geometry/vector.tcc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/geometry/vector.tcc')
-rw-r--r--2005/i/robert/src/geometry/vector.tcc21
1 files changed, 11 insertions, 10 deletions
diff --git a/2005/i/robert/src/geometry/vector.tcc b/2005/i/robert/src/geometry/vector.tcc
index 12120b0..7b6fa86 100644
--- a/2005/i/robert/src/geometry/vector.tcc
+++ b/2005/i/robert/src/geometry/vector.tcc
@@ -107,9 +107,9 @@ VectorT<T>::operator* (const VectorT<T> &v) const
/// Calcule la norme.
template<typename T>
T
-VectorT::norm (void)
+VectorT<T>::norm (void) const
{
- return sqrt (x * x + y * y);
+ return static_cast<T>(sqrt (x * x + y * y)); // XXX Il est propre le static_cast??
}
/// Normalise.
@@ -140,28 +140,29 @@ VectorT<T> &
VectorT<T>::rotate (T angle)
{
T tx = x;
- T c, s;
- sincos (angle, *s, *c);
- x = tx * c - y * s;
- y = tx * s + y * c;
+ double c, s;
+ sincos (angle, &s, &c);
+ x = static_cast<T>(tx * c - y * s); // XXX C'est propre ça?
+ y = static_cast<T>(tx * s + y * c);
+ return *this;
}
/// Distance à un autre point.
template<typename T>
T
-VectorT::distTo (const VectorT<T> &v) const
+VectorT<T>::distTo (const VectorT<T> &v) const
{
- return sqrt (sqDistTo (v));
+ return static_cast<T>(sqrt (sqDistTo (v))); // XXX propre??
}
/// Distance à un autre point au carré.
template<typename T>
T
-VectorT::sqDistTo (const VectorT<T> &v) const
+VectorT<T>::sqDistTo (const VectorT<T> &v) const
{
double dx = x - v.x;
double dy = y - v.y;
- return dx * dx + dy * dy;
+ return static_cast<T>(dx * dx + dy * dy);
}
/// Multiplication.