Пример #1
0
        /// <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 Linel?Intersect(Linel left, Linel 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 Linel?(new Linel(min, max)) : null);
        }
Пример #2
0
 /// <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(Linel left, Linel right)
 {
     return(left == right);
 }
Пример #3
0
 /// <summary>
 /// Writes the given <see cref="Linel"/> to an <see cref="Ibasa.IO.BinaryWriter">.
 /// </summary>
 public static void Write(this Ibasa.IO.BinaryWriter writer, Linel line)
 {
     writer.Write(line.Start);
     writer.Write(line.End);
 }