]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/offset.hh
* Documentation/user/changing-defaults.itely (Creating titles):
[lilypond.git] / flower / include / offset.hh
index b7fea1313abe0909026ccc12693e41c7bb592afb..2e2a7dd8e6d6ae3b53e3feeb3df26403fc7c934f 100644 (file)
@@ -7,20 +7,20 @@
 #ifndef OFFSET_HH
 #define OFFSET_HH
 
-#include "flower-proto.hh"
-#include "real.hh"
 #include "axes.hh"
-#include "arithmetic-operator.hh"
+#include "string.hh"
 
 Offset complex_multiply (Offset, Offset);
 Offset complex_divide (Offset, Offset);
 Offset complex_exp (Offset);
 
 
-/** 2d vector
-    should change to Complex -- how is vector == complex?
+/*
+
+This is a mixture a 2D vector. Sometimes it can
+also be convenient to think of 2D vectors as complex numbers
+(ie. x + i y). The naming of some methods reflects that.
 
-    ughr wat een beerput
 */
 class Offset 
 {
@@ -96,13 +96,12 @@ public:
     return *this;
   }
   
-  Real  arg () const;
+  Real arg () const;
   Real length () const;
 
-  //wtf, How is Offset a Complex? is this used?
   Offset operator *= (Offset z2) 
   {
-    *this = complex_multiply (*this,z2);
+    *this = complex_multiply (*this, z2);
     return *this;
   }
 
@@ -133,6 +132,13 @@ mirror (Offset o, Axis a)
   return o;
 }
 
+inline
+Real
+dot_product  (Offset o1, Offset o2)
+{
+  return o1[X_AXIS] * o2[X_AXIS] + o1[Y_AXIS] * o2[Y_AXIS];
+}
+
 
 #endif /* OFFSET_HH */