Cross() public method

Returns the cross product of this vector with the given one.
public Cross ( Vector3 other ) : Vector3
other Vector3 The other vector.
return Vector3
Example #1
0
        /// <summary>
        /// Calculates the view matrix.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="direction">The direction.</param>
        /// <param name="up">The up direction.</param>
        /// <returns>The calculated view matrix.</returns>
        public static Matrix CalculateViewMatrix(Vector3 position, Vector3 direction, Vector3 up)
        {
            var n = -direction.Normalized();
            var u = up.Cross(n).Normalized();
            var v = n.Cross(u);
            var e = -position;

            return new Matrix(
                u.X, v.X, n.X, 0,
                u.Y, v.Y, n.Y, 0,
                u.Z, v.Z, n.Z, 0,
                u.Dot(e), v.Dot(e), n.Dot(e), 1);
        }