# En klasse for tredimensjonal vektorer.
class Vector
  attr_reader :x, :y, :z
  def initialize( x, y, z )
    @x, @y, @z = x, y, z
  end
  def +(other)
    self.class.new( @x+other.x, @y+other.y, @z+other.z )
  end
  def -(other)
    self.class.new( @x-other.x, @y-other.y, @z-other.z )
  end
  def *(other)
    self.class.new( @x*other.x, @y*other.y, @z*other.z )
  end
  def to_a
    [@x, @y, @z]
  end
end
