Class: GeometricBoundingBox

Inherits:
Struct
  • Object
show all
Defined in:
lib/flash_math/modules/geometry/geometric_bounding_box.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#leftbottomObject

Returns the value of attribute leftbottom

Returns:

  • (Object)

    the current value of leftbottom



1
2
3
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 1

def leftbottom
  @leftbottom
end

#righttopObject

Returns the value of attribute righttop

Returns:

  • (Object)

    the current value of righttop



1
2
3
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 1

def righttop
  @righttop
end

Class Method Details

.new_by_arrays(point1_coordinates, point2_coordinates) ⇒ Object



3
4
5
6
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 3

def self.new_by_arrays(point1_coordinates, point2_coordinates)
  self.new(GeometricPoint.new_by_array(point1_coordinates),
           GeometricPoint.new_by_array(point2_coordinates))
end

Instance Method Details

#contains?(point) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 12

def contains?(point)
  point.x.between?(leftbottom.x, righttop.x) && point.y.between?(leftbottom.y, righttop.y)
end

#diagonalObject



8
9
10
# File 'lib/flash_math/modules/geometry/geometric_bounding_box.rb', line 8

def diagonal
  GeometricSegment.new(leftbottom, righttop)
end