/// <summary>
        /// Scales the <see cref="Vector3"/> by the scaling with the option to ignore some dimensions flags.
        /// </summary>
        /// <param name="scaler">The scaling service.</param>
        /// <param name="vector">The vector to scale.</param>
        /// <param name="ignoreFlags">Which dimensions to ignore.</param>
        /// <returns>A new scaled vector.</returns>
        public static Vector3 Scale(this IUnitScalerStrategy scaler, Vector3 vector, UnitScaleFlags ignoreFlags)
        {
            float x = ignoreFlags.QuickFlagsCheck(UnitScaleFlags.X) ? vector.x : scaler.ScaleX(vector.x);
            float y = ignoreFlags.QuickFlagsCheck(UnitScaleFlags.Y) ? vector.y : scaler.ScaleY(vector.y);;
            float z = ignoreFlags.QuickFlagsCheck(UnitScaleFlags.Z) ? vector.z : scaler.ScaleZ(vector.z);;

            return(new Vector3(x, y, z));
        }
Esempio n. 2
0
        /// <summary>
        /// Unscales the <see cref="Vector3"/> by the unscaling with the option to ignore some dimensions flags.
        /// </summary>
        /// <param name="scaler">The scaling service.</param>
        /// <param name="vector">The vector to scale.</param>
        /// <param name="ignoreFlags">Which dimensions to ignore.</param>
        /// <returns>A new scaled vector.</returns>
        public static Vector3 <float> UnScale(this IUnitScalerStrategy scaler, Vector3 <float> vector, UnitScaleFlags ignoreFlags)
        {
            float x = ignoreFlags.QuickFlagsCheck(UnitScaleFlags.X) ? vector.X : scaler.UnScaleX(vector.X);
            float y = ignoreFlags.QuickFlagsCheck(UnitScaleFlags.Y) ? vector.Y : scaler.UnScaleY(vector.Y);;
            float z = ignoreFlags.QuickFlagsCheck(UnitScaleFlags.Z) ? vector.Z : scaler.UnScaleZ(vector.Z);;

            return(new Vector3 <float>(x, y, z));
        }