Beispiel #1
0
        /// <summary>
        ///     Angles the clamp and normalize.
        /// </summary>
        /// <returns></returns>
        public bool AngleClampAndNormalize()
        {
            if (!IsValid())
            {
                return(false);
            }

            X = MathF.Clamp(X, -89.0f, 89.0f);
            Y = MathF.Normalize(Y, -180.0f, 180.0f, 360.0f);
            Z = 0.0f;

            return(IsValid());
        }
Beispiel #2
0
        /// <summary>
        ///     Angles the normalize.
        /// </summary>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="norm">The norm.</param>
        /// <returns></returns>
        public bool AngleNormalize(float min, float max, float norm)
        {
            if (!IsValid())
            {
                return(false);
            }

            Y = MathF.Normalize(Y, min, max, norm);

            Z = 0.0f;

            return(IsValid());
        }
        /// <summary>
        /// Angles the clamp and normalize.
        /// </summary>
        /// <returns></returns>
        public static bool AngleClampAndNormalize(this Vector3 obj)
        {
            if (!obj.IsValid())
            {
                return(false);
            }

            obj.X = MathF.Clamp(obj.X, -89.0f, 89.0f);
            obj.Y = MathF.Normalize(obj.Y, -180.0f, 180.0f, 360.0f);
            obj.Z = 0.0f;

            return(obj.IsValid());
        }
Beispiel #4
0
        /// <summary>
        ///     Angles the normalize.
        /// </summary>
        /// <returns></returns>
        public bool AngleNormalize()
        {
            if (!IsValid())
            {
                return(false);
            }

            Y = MathF.Normalize(Y, -180.0f, 180.0f, 360.0f);

            Z = 0.0f;

            return(IsValid());
        }
        /// <summary>
        /// Angles the normalize.
        /// </summary>
        /// <param name="obj">The object.</param>
        /// <param name="min">The minimum.</param>
        /// <param name="max">The maximum.</param>
        /// <param name="norm">The norm.</param>
        /// <returns></returns>
        public static bool AngleNormalize(this Vector3 obj, float min, float max, float norm)
        {
            if (!obj.IsValid())
            {
                return(false);
            }

            obj.Y = MathF.Normalize(obj.Y, min, max, norm);

            obj.Z = 0.0f;

            return(obj.IsValid());
        }