Пример #1
0
        /// <summary>
        /// Projects the given vector on this vector.
        /// </summary>
        /// <param name="source">The vector to project onto this vector.</param>
        /// <returns>The projected vector.</returns>
        /// <remarks>The projected vector will be in the same direction as this vector. The magnitude of the vector
        /// will be the magnitude of the given vector in this direction.</remarks>
        /// <exception cref="ArgumentNullException">Thrown when source is a null reference.</exception>
        public XYZ Project(XYZ source)
        {
            NullCheck(source, "source");

            return((DotProduct(source) / source.GetLength()) * Normalize());
        }
Пример #2
0
        /// <summary>
        /// Returns the angle between this vector and the specified vector.
        /// </summary>
        /// <param name="source">The specified vector.</param>
        /// <returns>The real number between 0 and PI equal to the angle between the two vectors in
        /// radians.</returns>
        /// <remarks>The angle between the two vectors is measured in the plane spanned by them.</remarks>
        /// <exception cref="ArgumentNullException">Thrown when source is a null reference.</exception>"
        public double AngleTo(XYZ source)
        {
            NullCheck(source, "source");

            return(Math.Acos(DotProduct(source) / (GetLength() * source.GetLength())));
        }