]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/offset.cc
Merge with master
[lilypond.git] / flower / offset.cc
index f578b191f9a4c8b93f4f694a8b8f06beefb522c8..086147188253c81e5e35e8a30f219e3307e3a7ff 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "offset.hh"
 
-
 #ifndef STANDALONE
 string
 Offset::to_string () const
@@ -75,6 +74,11 @@ Offset::arg () const
   return atan2 (coordinate_a_[Y_AXIS], coordinate_a_[X_AXIS]);
 }
 
+Real
+Offset::angle_degrees () const
+{
+  return arg () * 180 / M_PI;
+}
 /**
    euclidian vector length / complex modulus
 */
@@ -93,3 +97,11 @@ Offset::is_sane () const
     && !isinf (coordinate_a_[X_AXIS]) 
     && !isnan (coordinate_a_[Y_AXIS]);
 }
+
+Offset
+Offset::direction () const
+{
+  Offset d = *this;
+  d /= length (); 
+  return d;
+}