Exemplo n.º 1
0
 /// <summary>
 /// Project given vector onto a line
 /// </summary>
 /// <param name="left">First operand</param>
 /// <param name="right">Second operand</param>
 /// <returns>The closest point on the line</returns>
 public static void Snap(ref Vector2 left, ref Line2 right, out Vector2 result)
 {
     result = Line2.NearestPoint(right, left);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Project given vector onto a line
 /// </summary>
 /// <param name="left">First operand</param>
 /// <param name="right">Second operand</param>
 /// <returns>The closest point on the line</returns>
 public static Vector2 Snap(Vector2 left, Line2 right)
 {
     Snap(ref left, ref right, out Vector2 result);
     return(result);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Calculate the mirror projection of the given vector and line
        /// </summary>
        /// <param name="left">First operand</param>
        /// <param name="right">Second operand</param>
        /// <returns>The mirror projection of the input</returns>
        public static void Mirror(ref Vector2 left, ref Line2 right, out Vector2 result)
        {
            var nearest = Line2.NearestPoint(right, left);

            result = left + 2 * (nearest - left);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Calculate the mirror projection of the given vector and line
 /// </summary>
 /// <param name="left">First operand</param>
 /// <param name="right">Second operand</param>
 /// <returns>The mirror projection of the input</returns>
 public static Vector2 Mirror(Vector2 left, Line2 right)
 {
     Mirror(ref left, ref right, out Vector2 result);
     return(result);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Compute the euclidean distance between a vector and a line.
 /// </summary>
 /// <param name="vec1">The vector</param>
 /// <param name="line">The line</param>
 /// <param name="result">The distance</param>
 public static void Distance(ref Vector2 vec1, ref Line2 line, out double result)
 {
     result = Line2.Distance(line, vec1);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Compute the euclidean distance between a vector and a line.
 /// </summary>
 /// <param name="vec1">The vector</param>
 /// <param name="line">The line</param>
 /// <returns>The distance</returns>
 public static double Distance(Vector2 vec1, Line2 line)
 {
     Distance(ref vec1, ref line, out double result);
     return(result);
 }