private static byte ColorAngle(ColorBgra color, ColorBgra filter) { if (color == filter) { return(0); } Vector3D filterVector = filter.ToVector3D(); Vector3D colorVector = color.ToVector3D(); double scale = 2 * Vector3D.VectorAngle(colorVector, filterVector) / Math.PI; return(Utility.ClampToByte(scale * 255)); }