Module: Point::Array

Defined in:
lib/sixarm_ruby_geometry/point/array.rb,
lib/sixarm_ruby_geometry/point/array/d1.rb,
lib/sixarm_ruby_geometry/point/array/d2.rb,
lib/sixarm_ruby_geometry/point/array/d3.rb

Defined Under Namespace

Modules: D1, D2, D3

Instance Method Summary collapse

Instance Method Details

#+(other) ⇒ Object

Raises:

  • (::IndexError)


12
13
14
15
# File 'lib/sixarm_ruby_geometry/point/array.rb', line 12

def +(other)
  raise ::IndexError unless self.size == other.size
  self.size.times.map{|i| self[i] + other[i] }
end

#-(other) ⇒ Object

Raises:

  • (::IndexError)


17
18
19
20
# File 'lib/sixarm_ruby_geometry/point/array.rb', line 17

def -(other)
  raise ::IndexError unless self.size == other.size
  self.size.times.map{|i| self[i] - other[i] }
end