Пример #1
0
        /// <summary>
        /// Gets the transformation matrix for a "look at" situation. The camera is at CameraPosition
        /// and looks to CameraTarget. Additionally a normalvector CameraUpVector has to be given, because the
        /// Camera can turn up or down...
        /// </summary>
        /// <param name="CameraPosition">Position of the camera</param>
        /// <param name="CameraTarget">The camera looks to that point</param>
        /// <param name="CameraUpVector">Normalvector of the camera</param>
        /// <example> Matrix M = LookAt(new xyz(0,10,2), new xyz(0,0,2), new xyz(0,0,1));</example>
        /// <returns></returns>
        public static Matrix LookAt(xyz CameraPosition, xyz CameraTarget, xyz CameraUpVector)
        {
            Base B = Base.UnitBase;

            B = Base.LookAt(CameraPosition, CameraTarget, CameraUpVector);
            return(B.ToMatrix().invert());
        }