### Home Classes Methods

### In Files

- lib/term/ansicolor/rgb_color_metrics.rb

### Methods

- #weighted_euclidean_distance_to

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Term
- Term::ANSIColor
- Term::ANSIColor::Attribute
- Term::ANSIColor::PPMReader
- Term::ANSIColor::RGBColorMetrics
- Term::ANSIColor::RGBColorMetrics::CIELab
- Term::ANSIColor::RGBColorMetrics::CIELab::CIELabTriple
- Term::ANSIColor::RGBColorMetrics::CIEXYZ
- Term::ANSIColor::RGBColorMetrics::CIEXYZ::CIEXYZTriple
- Term::ANSIColor::RGBColorMetrics::CompuPhase
- Term::ANSIColor::RGBColorMetrics::Euclidean
- Term::ANSIColor::RGBColorMetrics::NTSC
- Term::ANSIColor::RGBColorMetrics::YUV
- Term::ANSIColor::RGBColorMetrics::YUV::YUVTriple
- Term::ANSIColor::RGBColorMetricsHelpers
- Term::ANSIColor::RGBColorMetricsHelpers::NormalizeRGBTriple
- Term::ANSIColor::RGBColorMetricsHelpers::WeightedEuclideanDistance
- Term::ANSIColor::RGBTriple

No matching classes.

# Term::ANSIColor::RGBColorMetricsHelpers::WeightedEuclideanDistance

### Public Instance Methods

weighted_euclidean_distance_to(other, weights = [ 1.0 ] * values.size) click to toggle source

    # File lib/term/ansicolor/rgb_color_metrics.rb, line 5
    def weighted_euclidean_distance_to(other, weights = [ 1.0 ] * values.size)
      sum = 0.0
      values.zip(other.values, weights) do |s, o, w|
        sum += w * (s - o) ** 2
      end
      Math.sqrt(sum)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.