Class: Circumcircle
- Inherits:
-
Object
- Object
- Circumcircle
- Defined in:
- lib/math_demo/circumcircle.rb
Overview
Circumcircle from 3 points
Instance Attribute Summary collapse
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
-
#radius ⇒ Object
readonly
Returns the value of attribute radius.
Instance Method Summary collapse
- #calculate ⇒ Object
-
#initialize(points) ⇒ Circumcircle
constructor
A new instance of Circumcircle.
Constructor Details
#initialize(points) ⇒ Circumcircle
Returns a new instance of Circumcircle.
7 8 9 |
# File 'lib/math_demo/circumcircle.rb', line 7 def initialize(points) @points = points end |
Instance Attribute Details
#center ⇒ Object (readonly)
Returns the value of attribute center.
6 7 8 |
# File 'lib/math_demo/circumcircle.rb', line 6 def center @center end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
6 7 8 |
# File 'lib/math_demo/circumcircle.rb', line 6 def points @points end |
#radius ⇒ Object (readonly)
Returns the value of attribute radius.
6 7 8 |
# File 'lib/math_demo/circumcircle.rb', line 6 def radius @radius end |
Instance Method Details
#calculate ⇒ Object
11 12 13 14 |
# File 'lib/math_demo/circumcircle.rb', line 11 def calculate @center = Vec2D.new(-(bx / am), -(by / am)) @radius = center.dist(points[2]) # points[2] = c end |