class RubyMan::AABB

Axis-Aligned Bounding Box

Attributes

x_beg[R]
x_end[R]
y_beg[R]
y_end[R]

Public Class Methods

new(x_beg, y_beg, x_end, y_end) click to toggle source
# File lib/ruby_man/aabb.rb, line 7
def initialize(x_beg, y_beg, x_end, y_end)
  @x_beg, @y_beg = x_beg, y_beg
  @x_end, @y_end = x_end, y_end
end

Public Instance Methods

intersects?(other) click to toggle source
# File lib/ruby_man/aabb.rb, line 12
def intersects?(other)
  @x_beg < other.x_end && @x_end > other.x_beg &&
    @y_beg < other.y_end && @y_end > other.y_beg
end