/// <summary> /// Returns the intersection of two lines. /// </summary> /// <param name="left">The first line.</param> /// <param name="right">The second line.</param> /// <returns>true if the left and right are equal; otherwise, false.</returns> public static Lined?Intersect(Lined left, Lined right) { var left_min = Functions.Min(left.Start, left.End); var left_max = Functions.Max(left.Start, left.End); var right_min = Functions.Min(right.Start, right.End); var right_max = Functions.Max(right.Start, right.End); var min = Functions.Max(left_min, right_min); var max = Functions.Min(left_max, right_max); return(min <= max ? new Lined?(new Lined(min, max)) : null); }
/// <summary> /// Returns a value that indicates whether two lines are equal. /// </summary> /// <param name="left">The first line to compare.</param> /// <param name="right">The second line to compare.</param> /// <returns>true if the left and right are equal; otherwise, false.</returns> public static bool Equals(Lined left, Lined right) { return(left == right); }
/// <summary> /// Writes the given <see cref="Lined"/> to an <see cref="Ibasa.IO.BinaryWriter">. /// </summary> public static void Write(this Ibasa.IO.BinaryWriter writer, Lined line) { writer.Write(line.Start); writer.Write(line.End); }