class Draught::BoundingBox

Attributes

paths[R]

Public Class Methods

new(*paths) click to toggle source
# File lib/draught/bounding_box.rb, line 10
def initialize(*paths)
  @paths = paths
end

Public Instance Methods

==(other) click to toggle source
# File lib/draught/bounding_box.rb, line 38
def ==(other)
  paths == other.paths
end
box_type() click to toggle source
# File lib/draught/bounding_box.rb, line 46
def box_type
  [:container]
end
containers() click to toggle source
# File lib/draught/bounding_box.rb, line 42
def containers
  []
end
height() click to toggle source
# File lib/draught/bounding_box.rb, line 18
def height
  y_max - y_min
end
lower_left() click to toggle source
# File lib/draught/bounding_box.rb, line 22
def lower_left
  @lower_left ||= Point.new(x_min, y_min)
end
transform(transformer) click to toggle source
# File lib/draught/bounding_box.rb, line 30
def transform(transformer)
  self.class.new(*paths.map { |path| path.transform(transformer) })
end
translate(point) click to toggle source
# File lib/draught/bounding_box.rb, line 26
def translate(point)
  self.class.new(*paths.map { |path| path.translate(point) })
end
width() click to toggle source
# File lib/draught/bounding_box.rb, line 14
def width
  x_max - x_min
end
zero_origin() click to toggle source
# File lib/draught/bounding_box.rb, line 34
def zero_origin
  move_to(Point::ZERO)
end

Private Instance Methods

lower_lefts() click to toggle source
# File lib/draught/bounding_box.rb, line 68
def lower_lefts
  @lower_lefts ||= paths.map(&:lower_left)
end
upper_rights() click to toggle source
# File lib/draught/bounding_box.rb, line 72
def upper_rights
  @upper_rights ||= paths.map(&:upper_right)
end
x_max() click to toggle source
# File lib/draught/bounding_box.rb, line 52
def x_max
  @x_max ||= upper_rights.map(&:x).max
end
x_min() click to toggle source
# File lib/draught/bounding_box.rb, line 56
def x_min
  @x_min ||= lower_lefts.map(&:x).min
end
y_max() click to toggle source
# File lib/draught/bounding_box.rb, line 60
def y_max
  @y_max ||= upper_rights.map(&:y).max
end
y_min() click to toggle source
# File lib/draught/bounding_box.rb, line 64
def y_min
  @y_min ||= lower_lefts.map(&:y).min
end