class DYI::Shape::Ellipse
Public Class Methods
create_on_center_radius(center, radius_x, radius_y, options={})
click to toggle source
# File lib/dyi/shape/base.rb, line 612 def create_on_center_radius(center, radius_x, radius_y, options={}) new(center, radius_x, radius_y, options) end
new(center, radius_x, radius_y, options={})
click to toggle source
@param [Coordinate] center a center coordinate of the ellipse @param [Length] radius_x an x-axis radius of the ellipse @param [Length] radius_y a y-axis radius of the ellipse @option options [Painting] :painting painting status of this shape @option options [String] :description the description of this shape @option options [String] :title the title of this shape
# File lib/dyi/shape/base.rb, line 573 def initialize(center, radius_x, radius_y, options={}) @center = Coordinate.new(center) @radius_x = Length.new(radius_x).abs @radius_y = Length.new(radius_y).abs @attributes = init_attributes(options) end
Public Instance Methods
bottom()
click to toggle source
# File lib/dyi/shape/base.rb, line 592 def bottom @center.y + @radius_y end
height()
click to toggle source
# File lib/dyi/shape/base.rb, line 600 def height @radius_y * 2 end
left()
click to toggle source
# File lib/dyi/shape/base.rb, line 580 def left @center.x - @radius_x end
right()
click to toggle source
# File lib/dyi/shape/base.rb, line 584 def right @center.x + @radius_x end
top()
click to toggle source
# File lib/dyi/shape/base.rb, line 588 def top @center.y - @radius_y end
width()
click to toggle source
# File lib/dyi/shape/base.rb, line 596 def width @radius_x * 2 end
write_as(formatter, io=$>)
click to toggle source
# File lib/dyi/shape/base.rb, line 604 def write_as(formatter, io=$>) formatter.write_ellipse(self, io, &(block_given? ? Proc.new : nil)) end