Sha256: 6c1ec4f799ff09b7e94a80eca9a5c3375f7e9d6058f8efd63c03efff7c5533d6
Contents?: true
Size: 530 Bytes
Versions: 1
Compression:
Stored size: 530 Bytes
Contents
module Photomosaic module Color class HSV attr_reader :hue, :saturation, :value def initialize(hue, saturation, value) @hue = hue @saturation = saturation @value = value end def calculate_distance(hsv) Math.sqrt(squares_array(hsv).inject(&:+)) end private def squares_array(hsv) [ (self.hue - hsv.hue)**2, (self.saturation - hsv.saturation)**2, (self.value - hsv.value)**2 ] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
photomosaic-0.0.1 | lib/photomosaic/color/hsv.rb |