Class: Sevgi::Geometry::Equation::Linear::Vertical
- Inherits:
-
Linear
- Object
- Linear
- Sevgi::Geometry::Equation::Linear::Vertical
- Defined in:
- lib/sevgi/geometry/equation/linear.rb
Instance Method Summary collapse
-
#initialize(c) ⇒ Vertical
constructor
A new instance of Vertical.
- #left?(point) ⇒ Boolean
- #on?(point) ⇒ Boolean
- #right?(point) ⇒ Boolean
- #shift(distance = nil, dx: nil, dy: nil) ⇒ Object
- #to_s ⇒ Object
- #x(_ = nil) ⇒ Object
- #y(_ = nil) ⇒ Object
Constructor Details
#initialize(c) ⇒ Vertical
Returns a new instance of Vertical.
64 65 66 67 68 |
# File 'lib/sevgi/geometry/equation/linear.rb', line 64 def initialize(c) super() @x = c end |
Instance Method Details
#left?(point) ⇒ Boolean
70 |
# File 'lib/sevgi/geometry/equation/linear.rb', line 70 def left?(point) = F.lt?(point.x, x(point.y)) |
#on?(point) ⇒ Boolean
72 |
# File 'lib/sevgi/geometry/equation/linear.rb', line 72 def on?(point) = F.eq?(point.x, x(point.y)) |
#right?(point) ⇒ Boolean
74 |
# File 'lib/sevgi/geometry/equation/linear.rb', line 74 def right?(point) = F.gt?(point.x, x(point.y)) |
#shift(distance = nil, dx: nil, dy: nil) ⇒ Object
76 77 78 79 80 |
# File 'lib/sevgi/geometry/equation/linear.rb', line 76 def shift(distance = nil, dx: nil, dy: nil) _dy = dy self.class.new(x + (distance || 0.0) + (dx || 0.0)) end |
#to_s ⇒ Object
82 |
# File 'lib/sevgi/geometry/equation/linear.rb', line 82 def to_s = "Linear<x = #{F.approx(x)}>" |
#x(_ = nil) ⇒ Object
84 |
# File 'lib/sevgi/geometry/equation/linear.rb', line 84 def x(_ = nil) = @x |
#y(_ = nil) ⇒ Object
86 |
# File 'lib/sevgi/geometry/equation/linear.rb', line 86 def y(_ = nil) = ::Float::INFINITY |