X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fbox.hh;h=685fbcff75a61fe3912134c75dfeaf4e23581df9;hb=f4abbfff5f0d985a457e15586dbcc3ae473b0dee;hp=a04661fa56a55b0f0d0e1e2f874c318228cbb673;hpb=5f14b2141454dd5d1c557c95923c5a33a984a480;p=lilypond.git diff --git a/lily/include/box.hh b/lily/include/box.hh index a04661fa56..685fbcff75 100644 --- a/lily/include/box.hh +++ b/lily/include/box.hh @@ -1,35 +1,41 @@ /* - some 2D geometrical concepts + some 2D geometrical concepts */ #ifndef BOXES_HH #define BOXES_HH -#include "flower-proto.hh" -#include "real.hh" #include "interval.hh" #include "offset.hh" +#include "smobs.hh" -struct Box +class Box { Interval interval_a_[NO_AXES]; - + DECLARE_SIMPLE_SMOBS (Box); +public: Interval &x () {return interval_a_[X_AXIS]; } - Interval &y (){ return interval_a_[Y_AXIS]; } - Interval x () const{ return interval_a_[X_AXIS]; } - Interval y () const{return interval_a_[Y_AXIS]; } - Interval operator[] (Axis a) const; - Interval &operator[] (Axis a); + Interval &y () { return interval_a_[Y_AXIS]; } + Interval x () const { return interval_a_[X_AXIS]; } + Interval y () const {return interval_a_[Y_AXIS]; } + Interval operator [] (Axis a) const; + Interval &operator [] (Axis a); + Real area () const; + bool is_empty () const; + bool is_empty (Axis a) const; Offset center () const; - + void translate (Offset o); + /// smallest box enclosing #b# void set_empty (); void add_point (Offset); void widen (Real x, Real y); void scale (Real r); void unite (Box b); + void intersect (Box b); + void print (); Box (); Box (Interval ix, Interval iy); };