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.
4 5 6 |
# File 'lib/ehb_game_lib/math/circle.rb', line 4 def center @center end |
#radius ⇒ Object (readonly)
Returns the value of attribute radius.
4 5 6 |
# File 'lib/ehb_game_lib/math/circle.rb', line 4 def radius @radius end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/ehb_game_lib/math/circle.rb', line 11 def to_s "C: #{center}, R: #{radius}" end |
#ys(x) ⇒ Object
15 16 17 |
# File 'lib/ehb_game_lib/math/circle.rb', line 15 def ys(x) QuadraticEquation.new(1, -2 * cy, ys_c(x)).roots end |