Module: Dieses::Geometry::Rect::Predicate
- Included in:
- Dieses::Geometry::Rect
- Defined in:
- lib/dieses/geometry/rect.rb
Instance Method Summary collapse
- #cover?(element) ⇒ Boolean
- #inside?(point) ⇒ Boolean
- #onto?(point) ⇒ Boolean
- #outside?(point) ⇒ Boolean
Instance Method Details
#cover?(element) ⇒ Boolean
106 107 108 109 |
# File 'lib/dieses/geometry/rect.rb', line 106 def cover?(element) bbox = element.bbox inside?(bbox.minimum) && inside?(bbox.maximum) end |
#inside?(point) ⇒ Boolean
92 93 94 95 96 |
# File 'lib/dieses/geometry/rect.rb', line 92 def inside?(point) onto?(point) || ( left.right?(point) && right.left?(point) && top.left?(point) && bottom.right?(point) ) end |
#onto?(point) ⇒ Boolean
102 103 104 |
# File 'lib/dieses/geometry/rect.rb', line 102 def onto?(point) left.onto?(point) || right.onto?(point) || top.onto?(point) || bottom.onto?(point) end |
#outside?(point) ⇒ Boolean
98 99 100 |
# File 'lib/dieses/geometry/rect.rb', line 98 def outside?(point) !inside?(point) end |