summaryrefslogtreecommitdiff
path: root/lily/boxes.cc
blob: 92c8fa6c5aab8f5d7484a2dc2d3d897c4095afce (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
  boxes.cc -- implement Box

  source file of the GNU LilyPond music typesetter

  (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/

#include "box.hh"
#include "array.hh"

void
Box::translate (Offset o)
{
  for (Axis i=X_AXIS; i < NO_AXES; incr(i))
    interval_a_[i] += o[i];
}

void
Box::unite (Box b)
{
  for (Axis i=X_AXIS; i < NO_AXES; incr(i))
    interval_a_[i].unite (b[i]);
}

/**
  Initialize to empty.
 */
Box::Box()
{        
}

Box::Box (Interval ix, Interval iy)
{
  x() = ix;
  y() = iy;
}

Interval &
Box::operator[] (Axis a)
{
  return interval_a_[a];
}

Interval
Box::operator[] (Axis a)const
{
  return interval_a_[a];
}