Exemplo n.º 1
0
        /// <summary>
        /// Determines whether the two <see cref="CoordinateVector" /> instances are parallel.
        /// </summary>
        /// <param name="first">The first vector.</param>
        /// <param name="second">The second vector.</param>
        /// <param name="precision">The precision model.</param>
        /// <returns><c>true</c> if the two <see cref="CoordinateVector" /> instances are parallel; otherwise <c>false</c>.</returns>
        public static Boolean IsParallel(CoordinateVector first, CoordinateVector second, PrecisionModel precision)
        {
            if (precision == null)
            {
                precision = PrecisionModel.Default;
            }

            return(Math.Abs(first._x * second._y - first._y * second._x) <= precision.Tolerance(first, second) &&
                   Math.Abs(first._x * second._z - first._z * second._z) <= precision.Tolerance(first, second));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Determines whether the two <see cref="CoordinateVector" /> instances are perpendicular.
        /// </summary>
        /// <param name="first">The first vector.</param>
        /// <param name="second">The second vector.</param>
        /// <param name="precision">The precision model.</param>
        /// <returns><c>true</c> if the two <see cref="CoordinateVector" /> instances are perpendicular; otherwise <c>false</c>.</returns>
        public static Boolean IsPerpendicular(CoordinateVector first, CoordinateVector second, PrecisionModel precision)
        {
            if (precision == null)
            {
                precision = PrecisionModel.Default;
            }

            return(first._x * second._x + first._y * second._y + first._z * second._z <= precision.Tolerance(first, second));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Computes the orientation of the specified <see cref="Coordinate" /> instances.
        /// </summary>
        /// <param name="origin">The coordinate of origin.</param>
        /// <param name="first">The first coordinate.</param>
        /// <param name="second">The second coordinate.</param>
        /// <param name="precision">The precision model.</param>
        /// <returns>The orientation of the second <see cref="Coordinate" /> to the first with respect to origin.</returns>
        public static Orientation Orientation(Coordinate origin, Coordinate first, Coordinate second, PrecisionModel precision)
        {
            if (precision == null)
            {
                precision = PrecisionModel.Default;
            }

            Double det = (first.X - origin.X) * (second.Y - origin.Y) - (first.Y - origin.Y) * (second.X - origin.X);

            if (Math.Abs(det) <= precision.Tolerance(origin, first, second))
            {
                return(AEGIS.Orientation.Collinear);
            }

            if (det > 0)
            {
                return(AEGIS.Orientation.CounterClockwise);
            }
            else
            {
                return(AEGIS.Orientation.Clockwise);
            }
        }