/// <summary> /// Initializes a new instance of the <see cref="ColorTriple"/> struct. /// </summary> /// <param name="color">The <see cref="ColorTriple"/>.</param> public ColorTriple(ColorTriple color) : this() { A = color.A; B = color.B; C = color.C; }
/// <summary> /// The length (the absolute value) of the vector spanned by /// the point (<paramref name="triple1"/>) and the /// point (<paramref name="triple2"/>). /// </summary> /// <param name="triple1">The triple1.</param> /// <param name="triple2">The triple2.</param> /// <returns> /// The length (the absolute value) of the vector. /// </returns> public static float Distance(ColorTriple triple1, ColorTriple triple2) { return (float)Math.Sqrt( Math.Pow(triple1.A - triple2.A, 2) + Math.Pow(triple1.B - triple2.B, 2) + Math.Pow(triple1.C - triple2.C, 2)); }
/// <summary> /// Computes the euclidian distance between this color and the specified /// <paramref name="foreignColor"/>. /// </summary> /// <param name="foreignColor">The foreign color to compare.</param> /// <returns>The euclidian distance between this color and the specified /// <paramref name="foreignColor"/>.</returns> public float ColorDistance(ColorTriple foreignColor) { return Vector.Distance(this, foreignColor); }
/// <summary> /// Computes the euclidian distance between this color and the specified /// <paramref name="foreignColor"/>. /// </summary> /// <param name="foreignColor">The foreign color to compare.</param> /// <returns>The euclidian distance between this color and the specified /// <paramref name="foreignColor"/>.</returns> public float ColorDistance(ColorTriple foreignColor) { return(Vector.Distance(this, foreignColor)); }