private Color GetInterpolationColorByHeatValue(double heatValue, HeatMapPaletteColorPoint frontColorPoint, HeatMapPaletteColorPoint backColorPoint) { double offsetDifference = (heatValue - frontColorPoint.Offset) / (backColorPoint.Offset - frontColorPoint.Offset); byte colorR = (byte)(frontColorPoint.Color.R + (backColorPoint.Color.R - frontColorPoint.Color.R) * offsetDifference); byte colorG = (byte)(frontColorPoint.Color.G + (backColorPoint.Color.G - frontColorPoint.Color.G) * offsetDifference); byte colorB = (byte)(frontColorPoint.Color.B + (backColorPoint.Color.B - frontColorPoint.Color.B) * offsetDifference); return(Color.FromRgb(colorR, colorG, colorB)); }
private bool IsHeatValueBetweenTwoColorPoints(double heatValue, HeatMapPaletteColorPoint frontColorPoint, HeatMapPaletteColorPoint backColorPoint) { return(frontColorPoint.Offset <= heatValue && backColorPoint.Offset >= heatValue); }