Sha256: b0fefabc12b5eb58040874537480d58bf555347d5be581e49c2592c186f8ea1c

Contents?: true

Size: 456 Bytes

Versions: 1

Compression:

Stored size: 456 Bytes

Contents

class GeometricBoundingBox < Struct.new(:leftbottom, :righttop)

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

  def diagonal
    GeometricSegment.new(leftbottom, righttop)
  end

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flash_math-0.0.1 lib/flash_math/modules/geometry/geometric_bounding_box.rb