This should be
```ruby
@delta_max ||=  Math.sqrt(delta_red**2 + delta_green**2 + delta_blue**2)
```
I had it wrong in my initial example.
(Source: [Calculate Distance between 2 points in a 3D space](http://www.calculatorsoup.com/calculators/geometry-solids/distance-two-points.php))