private Color ApplyColorimetry(Color original, ColorimetryInfo colorimetry) { var normal = CalculateFullNormal(); var g = ApplyColorimetryToComponent(original.G, colorimetry, normal); var r = ApplyColorimetryToComponent(original.R, colorimetry, normal); var b = ApplyColorimetryToComponent(original.B, colorimetry, normal); return(Color.FromArgb(r, g, b)); }
private static byte ApplyColorimetryToComponent(byte original, ColorimetryInfo colorimetry, Vector3D normal) { if (original == 0) { return(0); } var diffusion = (byte)(original * colorimetry.DiffusionRate); var lambertRate = Vector3D.ScalarNormalizedMultiplication(colorimetry.LightFall, normal); if (lambertRate >= -1 && lambertRate <= 1) { lambertRate = (lambertRate + 1) / 2; var lambertDiffusion = (byte)((255 - diffusion) * lambertRate * 0.5); return((byte)(diffusion + lambertDiffusion)); } return(diffusion); }
public Triangle2D Project(int d, ColorimetryInfo colorimetry) { return(new Triangle2D(_v1.Project(d), _v2.Project(d), _v3.Project(d), ApplyColorimetry(_color, colorimetry))); }