Ejemplo n.º 1
0
        /// <summary>
        /// Creates two Lines intersecting at their implied intersection, or the original Lines if the Lines are parallel
        /// </summary>
        /// <param name="thisLine"></param>
        /// <param name="thatLine"></param>
        /// <returns></returns>
        public static List <Line> CornerLines(Line thisLine, Line thatLine)
        {
            if (thisLine.IsParallelTo(thatLine))
            {
                return
                    (new List <Line>
                {
                    thisLine,
                    thatLine
                });
            }
            var inters     = thisLine.Intersection(thatLine);
            var thisGxLine = new GxLine(thisLine);
            var thatGxLine = new GxLine(thatLine);

            if (inters.DistanceTo(thisGxLine.Start) <= inters.DistanceTo(thisGxLine.End))
            {
                thisGxLine.Start = inters;
            }
            else
            {
                thisGxLine.End = inters;
            }
            if (inters.DistanceTo(thatGxLine.Start) <= inters.DistanceTo(thatGxLine.End))
            {
                thatGxLine.Start = inters;
            }
            else
            {
                thatGxLine.End = inters;
            }
            return
                (new List <Line>
            {
                thisGxLine.ToLine(),
                thatGxLine.ToLine()
            });
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Finds the implied intersection of this GxLine with a supplied GxLine.
 /// </summary>
 /// <param name="intr">GxLine to find intersection with this GxLine.</param>
 /// <returns>
 /// A Vector3 point or null if the lines are parallel.
 /// </returns>
 public Vector3 Intersection(GxLine line)
 {
     return(ToLine().Intersection(line.ToLine()));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Returns true if this GxLine is parallel to the supplied GxLine.
 /// </summary>
 /// <param name="thatLine">Line to compare to this line.</param>
 /// <returns>
 /// True if the Lines have equal slopes.
 /// </returns>
 public bool IsParallelTo(GxLine line)
 {
     return(ToLine().IsParallelTo(line.ToLine()));
 }