/// <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));
        }
Exemplo n.º 2
0
        /// <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 <float> Scale(this IUnitScalerStrategy scaler, Vector3 <float> 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 <float>(x, y, z));
        }
 /// <summary>
 /// Fully scales the <see cref="Vector2"/> by the scaling.
 /// </summary>
 /// <param name="scaler">The scaling service.</param>
 /// <param name="vector">The vector to scale.</param>
 /// <returns>A new scaled vector.</returns>
 public static Vector2 Scale(this IUnitScalerStrategy scaler, Vector2 <float> vector)
 {
     return(new Vector2(scaler.ScaleX(vector.X), scaler.ScaleY(vector.Y)));
 }
 /// <summary>
 /// Fully scales the <see cref="Vector2"/> by the scaling.
 /// </summary>
 /// <param name="scaler">The scaling service.</param>
 /// <param name="vector">The vector to scale.</param>
 /// <returns>A new scaled vector.</returns>
 public static Vector2 Scale(this IUnitScalerStrategy scaler, Vector2 vector)
 {
     return(new Vector3(scaler.ScaleX(vector.x), scaler.ScaleY(vector.y)));
 }