Exemple #1
0
        /// <summary>
        /// The square distance between the given point and the line, defined by this segment.
        /// </summary>
        /// <param name="p">The point.</param>
        /// <returns>Returns the square distance between the given point and the line, defined by this segment.</returns>
        public double LineDistanceSqr(Vector2d p)
        {
            var ap        = p - a;
            var dotprod   = ab.Dot(ap);
            var projLenSq = dotprod * dotprod / ab.SqrMagnitude();

            return(ap.SqrMagnitude() - projLenSq);
        }
Exemple #2
0
 public static bool operator !=(Vector2d lhs, Vector2d rhs)
 {
     return((double)Vector2d.SqrMagnitude(lhs - rhs) >= 0.0 / 1.0);
 }
Exemple #3
0
 public static bool operator ==(Vector2d lhs, Vector2d rhs)
 {
     return(Vector2d.SqrMagnitude(lhs - rhs) < 0.0 / 1.0);
 }
Exemple #4
0
 public static bool operator ==(Vector2d lhs, Vector2d rhs)
 {
     // Implementation similar to Vector3
     return(Vector2d.SqrMagnitude(lhs - rhs) < EPSILON_MAGNITUDE_SQR);
 }