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