X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Finclude%2Foffset.hh;h=ccf64ea784e172007a99c10a63888461b852542d;hb=15af6574b4ad5c382867f76cbd3938fde1cc10db;hp=b7fea1313abe0909026ccc12693e41c7bb592afb;hpb=da66c77772050eccbb972538c2cf9f6ec76018b4;p=lilypond.git diff --git a/flower/include/offset.hh b/flower/include/offset.hh index b7fea1313a..ccf64ea784 100644 --- a/flower/include/offset.hh +++ b/flower/include/offset.hh @@ -11,16 +11,19 @@ #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 +99,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 +135,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 */