Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / stable / src / synfig / vector.h
index e44137a..46baff8 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -27,6 +28,7 @@
 
 /* === H E A D E R S ======================================================= */
 
+#include "angle.h"
 #include "real.h"
 #include <math.h>
 
@@ -78,11 +80,11 @@ public:
 
        value_type &
        operator[](const int& i)
-       { return (&_x)[i] ; }
+       { return i?_y:_x; }
 
        const value_type &
        operator[](const int& i) const
-       { return (&_x)[i] ; }
+       { return i?_y:_x; }
 
        const Vector &
        operator+=(const Vector &rhs)
@@ -169,6 +171,9 @@ public:
        Vector perp()const
                { return Vector(_y,-_x); }
 
+       Angle angle()const
+               { return Angle::rad(atan2(_y, _x)); }
+
        bool is_equal_to(const Vector& rhs)const
        {
                static const value_type epsilon(0.0000000000001);
@@ -271,7 +276,7 @@ public:
        { return (&a)[i]; }
 
        //! Bezier curve intersection function
-       time_type intersect(const bezier_base<value_type,time_type> &x, time_type near=0.0)const
+       time_type intersect(const bezier_base<value_type,time_type> &/*x*/, time_type /*near*/=0.0)const
        {
                return 0;
        }