X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fbox.hh;h=d4a8655a429b0cf965364132871cf2b7f9c3b054;hb=bf14e3a7d89454c17f65b291d192d05752afad27;hp=b26c6e36955b0c85fab3f7f083414014dfd11916;hpb=1cf3d59c1559fb9774c4c1c8cae155cfe54a927c;p=lilypond.git diff --git a/lily/include/box.hh b/lily/include/box.hh index b26c6e3695..d4a8655a42 100644 --- a/lily/include/box.hh +++ b/lily/include/box.hh @@ -1,31 +1,44 @@ /* - some 2D geometrical concepts + some 2D geometrical concepts */ #ifndef BOXES_HH #define BOXES_HH -#include "fproto.hh" -#include "real.hh" #include "interval.hh" #include "offset.hh" -#include "axes.hh" +#include "smobs.hh" - -struct Box { +class Box : public Simple_smob +{ +public: + static const char * const type_p_name_; +private: Interval interval_a_[NO_AXES]; - - 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); - +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); + 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); - Box(); + void intersect (Box b); + void print (); + Box (); Box (Interval ix, Interval iy); };