/// <summary> /// http://stackoverflow.com/a/27375621/2196124 /// </summary> internal static int closestColor1(IEnumerable<ByteColor> colors, ByteColor target) { var hue1 = target.GetHue(); var diffs = colors.Select<ByteColor, float>(n => getHueDistance(n.GetHue(), hue1)); var diffMin = diffs.Min(n => n); return diffs.ToList().FindIndex(n => n == diffMin); }
/// <summary> /// Initializes a new instance of the <see cref="Light"/> class. /// </summary> public Light(byte lightType, Vertex position, ByteColor color, float intensity = 0.0f, ushort intensity1 = 0, ushort intensity2 = 0, uint fade1 = 0, uint fade2 = 0, byte unknown = 255, float hotspot = 0.0f, float falloff = 0.0f, float length = 0.0f, float cutoff = 0.0f, Vertex direction = default(Vertex), Vertex position2 = default(Vertex), Vertex direction2 = default(Vertex), float radInput = 0.0f, float radOutput = 0.0f, float range = 0.0f) { this.lightType = lightType; Position = position; Color = color; Intensity = intensity; Intensity1 = intensity1; Intensity2 = intensity2; Fade1 = fade1; Fade2 = fade2; Unknown = unknown; R_Inner = hotspot; R_Outer = falloff; Length = length; Cutoff = cutoff; Direction = direction; Position2 = position2; Direction2 = direction2; RadianInput = radInput; RadianOutput = radOutput; Range = range; }