///<summary>/// 旋转向量,使其方向改变,大小不变///</summary>///<param name="v">需要旋转的向量</param>///<param name="angle">旋转的角度</param>///<returns>旋转后的向量</returns>private Vector2 RotationMatrix(Vector2 v, float angle){
var x = v.x;
var y = v.y;
var sin = Math.Sin(Math.PI * angle / 180);
var cos = Math.Cos(Math.PI * angle / 180);
var newX = x * cos + y * sin;
var newY = x * -sin + y * cos;
returnnew Vector2((float)newX, (float)newY);
}