Truncate Vector2 : Vector « Development Class « C# / C Sharp






Truncate Vector2

        

using Microsoft.Xna.Framework;

namespace Core
{
    public class Vector2Utilities
    {
        public static void Truncate(Vector2 original, float max)
        {
            if (original.Length() > max)
            {
                original.Normalize();

                original *= max;
            }
        }

    }
}

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Vector class
2.Perpendicular Vector2
3.Vector2D struct
4.Gets the perpendicular vector to a specified vector
5.Compares Vector3 values for equality
6.Rotate Vector
7.Finds the cross product of the 2 vectors created by the 3 vertices.
8.Remap a value specified relative to a pair of bounding values to the corresponding value relative to another pair of bounds.