class Charta::BoundingBox

Attributes

x_max[R]
x_min[R]
y_max[R]
y_min[R]

Public Class Methods

new(y_min, x_min, y_max, x_max) click to toggle source
# File lib/charta/bounding_box.rb, line 5
def initialize(y_min, x_min, y_max, x_max)
  @y_min = y_min
  @x_min = x_min
  @y_max = y_max
  @x_max = x_max
end

Public Instance Methods

height() click to toggle source
# File lib/charta/bounding_box.rb, line 16
def height
  @y_max - @y_min
end
svg_view_box() click to toggle source
# File lib/charta/bounding_box.rb, line 20
def svg_view_box
  [x_min, -y_max, width, height]
end
to_a() click to toggle source
# File lib/charta/bounding_box.rb, line 24
def to_a
  [[@y_min, @x_min], [@y_max, @x_max]]
end
to_bbox_string() click to toggle source
# File lib/charta/bounding_box.rb, line 28
def to_bbox_string
  "#{@x_min}, #{@y_min}, #{x_max}, #{y_max}"
end
width() click to toggle source
# File lib/charta/bounding_box.rb, line 12
def width
  @x_max - @x_min
end