X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Foffset.cc;h=67b97865e55ebe5f723fd2f717616257b72f9d48;hb=5b4b0d6e9a197e8f9eb085b7c2ad78b8be3e5cfc;hp=086147188253c81e5e35e8a30f219e3307e3a7ff;hpb=3ee551fa4f2a2c3736a06f9f85f29b9f7bd89818;p=lilypond.git diff --git a/flower/offset.cc b/flower/offset.cc index 0861471882..67b97865e5 100644 --- a/flower/offset.cc +++ b/flower/offset.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--2007 Han-Wen Nienhuys + (c) 1997--2008 Han-Wen Nienhuys */ #include "offset.hh" @@ -19,12 +19,6 @@ Offset::to_string () const } #endif -bool -isinf_b (Real r) -{ - return (fabs (r) > 1e20); -} - /* free bsd fix by John Galbraith */ @@ -33,7 +27,7 @@ Offset complex_multiply (Offset z1, Offset z2) { Offset z; - if (!isinf_b (z2[Y_AXIS])) + if (!isinf (z2[Y_AXIS])) { z[X_AXIS] = z1[X_AXIS] * z2[X_AXIS] - z1[Y_AXIS] * z2[Y_AXIS]; z[Y_AXIS] = z1[X_AXIS] * z2[Y_AXIS] + z1[Y_AXIS] * z2[X_AXIS]; @@ -95,7 +89,7 @@ Offset::is_sane () const return !isnan (coordinate_a_[X_AXIS]) && !isnan (coordinate_a_ [Y_AXIS]) && !isinf (coordinate_a_[X_AXIS]) - && !isnan (coordinate_a_[Y_AXIS]); + && !isinf (coordinate_a_[Y_AXIS]); } Offset @@ -105,3 +99,9 @@ Offset::direction () const d /= length (); return d; } + +Offset +Offset::swapped () const +{ + return Offset (coordinate_a_[Y_AXIS], coordinate_a_[X_AXIS]); +}