]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/offset.cc
junk #'arrow property.
[lilypond.git] / flower / offset.cc
index b45809e0b9ed82322fb243a18fef7a748540f1c3..086147188253c81e5e35e8a30f219e3307e3a7ff 100644 (file)
@@ -3,19 +3,18 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "offset.hh"
 
-
 #ifndef STANDALONE
-std::string
+string
 Offset::to_string () const
 {
-  std::string s;
-  s = std::string (" (") + std::to_string (coordinate_a_[X_AXIS]) + ", "
-    + std::to_string (coordinate_a_[Y_AXIS]) + ")";
+  string s;
+  s = string (" (") + ::to_string (coordinate_a_[X_AXIS]) + ", "
+    + ::to_string (coordinate_a_[Y_AXIS]) + ")";
   return s;
 }
 #endif
@@ -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;
+}