class Euclidean::CenterDiameterCircle

Attributes

diameter[R]

@return [Number] The {Circle}‘s diameter

Public Class Methods

new(center, diameter) click to toggle source

Construct a new {Circle} from a centerpoint and a diameter @param [Point] center The center point of the {Circle} @param [Number] diameter The radius of the {Circle} @return [Circle] A new {Circle} object

# File lib/euclidean/circle.rb, line 113
def initialize(center, diameter)
  @center = Point[center]
  @diameter = diameter
end

Public Instance Methods

==(other)
Alias for: eql?
eql?(other) click to toggle source
# File lib/euclidean/circle.rb, line 118
def eql?(other)
  (self.center == other.center) && (self.diameter == other.diameter)
end
Also aliased as: ==
radius() click to toggle source

@!group Accessors @return [Number] The {Circle}‘s radius

# File lib/euclidean/circle.rb, line 125
  def radius
@diameter/2
  end