Class: VectorBeWinding::Shape
- Inherits:
-
Object
- Object
- VectorBeWinding::Shape
- Defined in:
- lib/vector_be_winding/shape.rb
Instance Method Summary collapse
-
#bounding_rect ⇒ Object
Each subclass must override it.
-
#containingness(shape1) ⇒ Object
Very naive definition.
- #contains?(shape1) ⇒ Boolean
-
#intersectedness(shape1) ⇒ Object
Very naive definition.
- #intersects?(shape1) ⇒ Boolean
Instance Method Details
#bounding_rect ⇒ Object
Each subclass must override it
4 5 6 |
# File 'lib/vector_be_winding/shape.rb', line 4 def bounding_rect raise 'implment this' end |
#containingness(shape1) ⇒ Object
Very naive definition. Each subclass is expected to override it negative: no containing, 0: containing with border, positive: inside
24 25 26 |
# File 'lib/vector_be_winding/shape.rb', line 24 def containingness(shape1) bounding_rect.containingness(shape1.bounding_rect) end |
#contains?(shape1) ⇒ Boolean
18 19 20 |
# File 'lib/vector_be_winding/shape.rb', line 18 def contains?(shape1) containingness(shape1) >= 0 end |
#intersectedness(shape1) ⇒ Object
Very naive definition. Each subclass is expected to override it negative: no intersected, 0: touched, positive: intersected
14 15 16 |
# File 'lib/vector_be_winding/shape.rb', line 14 def intersectedness(shape1) bounding_rect.intersectedness(shape1.bounding_rect) end |
#intersects?(shape1) ⇒ Boolean
8 9 10 |
# File 'lib/vector_be_winding/shape.rb', line 8 def intersects?(shape1) intersectedness(shape1) >= 0 end |