Class: VectorBeWinding::Shape

Inherits:
Object
  • Object
show all
Defined in:
lib/vector_be_winding/shape.rb

Direct Known Subclasses

Path, Rect, Segment, SubPath

Instance Method Summary collapse

Instance Method Details

#bounding_rectObject

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

Returns:

  • (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

Returns:

  • (Boolean)


8
9
10
# File 'lib/vector_be_winding/shape.rb', line 8

def intersects?(shape1)
  intersectedness(shape1) >= 0
end