/// <summary>
        /// Calculates the angle between the specified points around the specified axis.
        /// </summary>
        /// <param name="center">The center of the angle.</param>
        /// <param name="start">The start of the angle.</param>
        /// <param name="end">The end of the angle.</param>
        /// <param name="axis">The axis around which the angle is calculated.</param>
        /// <returns>The angle, in degrees.</returns>
        public static double Angle(this CameraSpacePoint center, CameraSpacePoint start, CameraSpacePoint end, Axis axis)
        {
            switch (axis)
            {
            case Axis.X:
                start.X  = 0f;
                center.X = 0f;
                end.X    = 0f;
                break;

            case Axis.Y:
                start.Y  = 0f;
                center.Y = 0f;
                end.Y    = 0f;
                break;

            case Axis.Z:
                start.Z  = 0f;
                center.Z = 0f;
                end.Z    = 0f;
                break;
            }

            Vector3 first  = start.ToVector3() - center.ToVector3();
            Vector3 second = end.ToVector3() - center.ToVector3();

            return(Vector3.Angle(first, second));
        }
        /// <summary>
        /// Calculates the angle between the specified points.
        /// </summary>
        /// <param name="center">The center of the angle.</param>
        /// <param name="start">The start of the angle.</param>
        /// <param name="end">The end of the angle.</param>
        /// <returns>The angle, in degrees.</returns>
        public static double Angle(this CameraSpacePoint center, CameraSpacePoint start, CameraSpacePoint end)
        {
            Vector3 first  = start.ToVector3() - center.ToVector3();
            Vector3 second = end.ToVector3() - center.ToVector3();

            return(Vector3.Angle(first, second));
        }
Пример #3
0
        /// <summary>
        /// Calculates the angle between the specified points.
        /// </summary>
        /// <param name="center">The center of the angle.</param>
        /// <param name="start">The start of the angle.</param>
        /// <param name="end">The end of the angle.</param>
        /// <returns>The angle, in degrees.</returns>
        public static double Angle(this CameraSpacePoint center, CameraSpacePoint start, CameraSpacePoint end)
        {
            Vector3D first = start.ToVector3() - center.ToVector3();
            Vector3D second = end.ToVector3() - center.ToVector3();

            return Vector3D.AngleBetween(first, second);
        }
Пример #4
0
        /// <summary>
        /// Calculates the angle between the specified points around the specified axis.
        /// </summary>
        /// <param name="center">The center of the angle.</param>
        /// <param name="start">The start of the angle.</param>
        /// <param name="end">The end of the angle.</param>
        /// <param name="axis">The axis around which the angle is calculated.</param>
        /// <returns>The angle, in degrees.</returns>
        public static double Angle(this CameraSpacePoint center, CameraSpacePoint start, CameraSpacePoint end, Axis axis)
        {
            switch (axis)
            {
                case Axis.X:
                    start.X = 0f;
                    center.X = 0f;
                    end.X = 0f;
                    break;
                case Axis.Y:
                    start.Y = 0f;
                    center.Y = 0f;
                    end.Y = 0f;
                    break;
                case Axis.Z:
                    start.Z = 0f;
                    center.Z = 0f;
                    end.Z = 0f;
                    break;
            }

            Vector3D first = start.ToVector3() - center.ToVector3();
            Vector3D second = end.ToVector3() - center.ToVector3();

            return Vector3D.AngleBetween(first, second);
        }