Class: Sevgi::Geometry::Element::Arced
- Inherits:
-
Sevgi::Geometry::Element
- Object
- Sevgi::Geometry::Element
- Sevgi::Geometry::Element::Arced
- Defined in:
- lib/sevgi/geometry/element.rb
Overview
Abstract family of circular and elliptical boundary elements. Arc is open, while Ellipse and Circle have closed boundaries. Concrete values share exact and precision-aware comparisons.
Direct Known Subclasses
Instance Method Summary collapse
-
#eq?(other, precision: nil) ⇒ Boolean
Compares canonical fields with coordinate and numeric precision.
-
#eql?(other) ⇒ Boolean
(also: #==)
Reports strict equality by concrete class and canonical fields.
-
#hash ⇒ Integer
Returns a hash independent of numeric precision.
-
#outside?(point) ⇒ Boolean
Reports whether a point is outside the element.
Methods inherited from Sevgi::Geometry::Element
#at, #box, #closed?, #equations, #ignorable?, #intersection, lined, #position, #translate
Instance Method Details
#eq?(other, precision: nil) ⇒ Boolean
Compares canonical fields with coordinate and numeric precision.
635 636 637 638 639 640 |
# File 'lib/sevgi/geometry/element.rb', line 635 def eq?(other, precision: nil) other.instance_of?(self.class) && state.zip(other.send(:state)).all? do |left, right| left.is_a?(::Numeric) ? F.eq?(left, right, precision:) : left.eq?(right, precision:) end end |
#eql?(other) ⇒ Boolean Also known as: ==
Reports strict equality by concrete class and canonical fields.
645 |
# File 'lib/sevgi/geometry/element.rb', line 645 def eql?(other) = other.instance_of?(self.class) && state == other.send(:state) |
#hash ⇒ Integer
Returns a hash independent of numeric precision.
649 |
# File 'lib/sevgi/geometry/element.rb', line 649 def hash = [self.class, *state].hash |
#outside?(point) ⇒ Boolean
Reports whether a point is outside the element.
655 |
# File 'lib/sevgi/geometry/element.rb', line 655 def outside?(point) = !inside?(point) |