天天看点

【XNA 4】C# XNA 计算一个二维向量的垂直向量

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; // 或者 x = -x,分别是+pi/2和-pi/2的效果

            return new Vector2(y, x);
        }      

转载于:https://www.cnblogs.com/thefake/articles/3235680.html

c#