class Circle

Attributes

point[RW]
radius[RW]
vector[RW]

Public Class Methods

new(point = Point.new(0, 0, 0), vector = Vector.new(0, 0, 1), radius) click to toggle source
# File lib/geometry_3d/circle.rb, line 6
def initialize(point = Point.new(0, 0, 0), vector = Vector.new(0, 0, 1), radius)
  @point = point
  @radius = radius
  @vector = vector
end

Public Instance Methods

area() click to toggle source

Find the area of a circle.

Example:

>> Circle.new(Point.new(1, 2, 3), Vector.new(1, 1, 1), 3)
=> 28.274333882308138

Arguments:

no
# File lib/geometry_3d/circle.rb, line 21
def area
  Math::PI * radius ** 2
end
perimeter() click to toggle source

Find the perimeter of a circle.

Example:

>> Circle.new(Point.new(1, 2, 3), Vector.new(1, 1, 1), 3)
=> 18.84955592153876

Arguments:

no
# File lib/geometry_3d/circle.rb, line 34
def perimeter
  2 * Math::PI * radius
end