Example #1
0
        /// <summary>
        /// Hard clamps the value to the nearest limit.
        /// </summary>
        /// <param name="value">Value to clamp.</param>
        /// <param name="upperLimit"></param>
        /// <param name="centerLimit"></param>
        /// <param name="bottomLimit"></param>
        /// <returns></returns>
        public static Vector2 HardClamp(Vector2 value, int bottomLimit, int centerLimit, int upperLimit)
        {
            Vector2 clampedValue = new Vector2(
                Hedra.HardClamp(value.x, bottomLimit, centerLimit, upperLimit),
                Hedra.HardClamp(value.y, bottomLimit, centerLimit, upperLimit)
                );

            return(clampedValue);
        }
Example #2
0
        /// <summary>
        /// Hard clamps the value to the nearest limit.
        /// </summary>
        /// <param name="value">Value to clamp.</param>
        /// <param name="upperLimit"></param>
        /// <param name="centerLimit"></param>
        /// <param name="bottomLimit"></param>
        /// <returns></returns>
        public static Vector3 HardClamp(Vector3 value, float bottomLimit, float centerLimit, float upperLimit)
        {
            Vector3 clampedValue = new Vector3(
                Hedra.HardClamp(value.x, bottomLimit, centerLimit, upperLimit),
                Hedra.HardClamp(value.y, bottomLimit, centerLimit, upperLimit),
                Hedra.HardClamp(value.z, bottomLimit, centerLimit, upperLimit)
                );

            return(clampedValue);
        }