Interface AestheticDifference


public interface AestheticDifference
Used by DetailedMimic to allow different kinds of detail, including differentiating color or map features. Created by Tommy Ettinger on 6/9/2016.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static AestheticDifference rgba8888  
  • Method Summary

    Modifier and Type Method Description
    double difference​(int a, int b)
    Finds the difference between two int values, which implementations of this interface may treat as colors, as kinds of map feature, as item placement factors, or various other ways.
  • Field Details

  • Method Details

    • difference

      double difference​(int a, int b)
      Finds the difference between two int values, which implementations of this interface may treat as colors, as kinds of map feature, as item placement factors, or various other ways. The difference should be, on average, about 1.0 for inputs that have a decent range of values (shades of color as well as changes in hue, etc.).
      The original implementation looked something like this, assuming the SquidColorCenter (from the display module, not present in squidlib-util) was instantiated earlier for better efficiency:
           SquidColorCenter scc = new SquidColorCenter();
           Color c1 = scc.get(a), c2 = scc.get(b);
           return ((c1.r - c2.r) * (c1.r - c2.r) + (c1.g - c2.g) * (c1.g - c2.g) + (c1.b - c2.b) * (c1.b - c2.b)) / 65536.0;
       
      Parameters:
      a - an int that may be interpreted in different ways by different implementations
      b - another int that may be interpreted in different ways by different implementations
      Returns:
      the difference between a and b, ideally averaging about 1.0 for most inputs