X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvector.h;h=46baff80b1feec4489bc08eb41e7707c24cf1753;hb=37600b4b217caa5e316984ec0b035c5e8f9698af;hp=c509c3cd47719de524b0d56694522c96d6abf601;hpb=c3ad95144d148602f672e95ddda1f18fc35502f8;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/vector.h b/synfig-core/trunk/src/synfig/vector.h index c509c3c..46baff8 100644 --- a/synfig-core/trunk/src/synfig/vector.h +++ b/synfig-core/trunk/src/synfig/vector.h @@ -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 @@ -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);