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






Perpendicular Vector2

        


using Microsoft.Xna.Framework;

namespace Core
{
    public class Vector2Utilities
    {

        public static Vector2 Perpendicular(Vector2 original)
        {
            //To create a perpendicular vector switch X and Y, then make Y negative
            float x = original.X;
            float y = original.Y;

            y = -y;

            return new Vector2(y, x);
        }
    }
}

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Vector class
2.Truncate 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.