Class: EhbGameLib::Math::Circle
- Inherits:
-
Object
- Object
- EhbGameLib::Math::Circle
- Defined in:
- lib/ehb_game_lib/math/circle.rb
Instance Attribute Summary collapse
-
#center ⇒ Object
readonly
Returns the value of attribute center.
-
#radius ⇒ Object
readonly
Returns the value of attribute radius.
Instance Method Summary collapse
-
#initialize(cx, cy, radius) ⇒ Circle
constructor
A new instance of Circle.
- #to_s ⇒ Object
- #ys(x) ⇒ Object
Constructor Details
Instance Attribute Details
#center ⇒ Object (readonly)
Returns the value of attribute center.
6 7 8 |
# File 'lib/ehb_game_lib/math/circle.rb', line 6 def center @center end |
#radius ⇒ Object (readonly)
Returns the value of attribute radius.
6 7 8 |
# File 'lib/ehb_game_lib/math/circle.rb', line 6 def radius @radius end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/ehb_game_lib/math/circle.rb', line 13 def to_s "C: #{center}, R: #{radius}" end |
#ys(x) ⇒ Object
17 18 19 |
# File 'lib/ehb_game_lib/math/circle.rb', line 17 def ys(x) QuadraticEquation.new(1, -2 * cy, ys_c(x)).roots end |