Normalize() public method

public Normalize ( ) : Vector2
return Vector2
示例#1
0
 public float Angle360(Vector2 vector)
 {
     var vec = this.Normalize();
     vector = vector.Normalize();
     float value = ((float)Math.Atan2((vec.X*vector.Y)-(vec.Y*vector.X), (vec.X*vector.X)+(vec.Y*vector.Y))) % MathUtilities.Pi2;
     return (value < 0) ? ((MathUtilities.Pi+value)+MathUtilities.Pi) : value;
 }
示例#2
0
 public float Angle90(Vector2 vector)
 {
     var vec = this.Normalize();
     float val = Math.Abs(vec.Dot(vector.Normalize()));
     val = (val > 1) ? 1 : val;
     return (float)Math.Acos(val);
 }
示例#3
0
 public static void Angle90(ref Vector2 vector1, ref Vector2 vector2, out float result)
 {
     var vec = vector1.Normalize();
     float val = Math.Abs(vec.Dot(vector2.Normalize()));
     val = (val > 1) ? 1 : val;
     result = (float)Math.Acos(val);
 }
示例#4
0
 public float Angle180(Vector2 vector)
 {
     var vec = this.Normalize();
     vector = vector.Normalize();
     return ((float)Math.Atan2((vec.X*vector.Y)-(vec.Y*vector.X), (vec.X*vector.X)+(vec.Y*vector.Y))) % MathUtilities.Pi2;
 }
示例#5
0
 public static void Angle360(ref Vector2 vector1, ref Vector2 vector2, out float result)
 {
     var vec = vector1.Normalize();
     vector2 = vector2.Normalize();
     float value = ((float)Math.Atan2((vec.X*vector2.Y)-(vec.Y*vector2.X), (vec.X*vector2.X)+(vec.Y*vector2.Y))) % MathUtilities.Pi2;
     result = (value < 0) ? ((MathUtilities.Pi+value)+MathUtilities.Pi) : value;
 }
示例#6
0
 public static void Angle360(ref Vector2 vector, out float result)
 {
     var vec = vector.Normalize();
     float value = ((float)Math.Atan2(-vec.Y, vec.X)) % MathUtilities.Pi2;
     result = (value < 0) ? ((MathUtilities.Pi+value)+MathUtilities.Pi) : value;
 }
示例#7
0
 public static void Angle180(ref Vector2 vector1, ref Vector2 vector2, out float result)
 {
     var vec = vector1.Normalize();
     vector2 = vector2.Normalize();
     result = ((float)Math.Atan2((vec.X*vector2.Y)-(vec.Y*vector2.X), (vec.X*vector2.X)+(vec.Y*vector2.Y))) % MathUtilities.Pi2;
 }
示例#8
0
 public static void Angle180(ref Vector2 vector, out float result)
 {
     var vec = vector.Normalize();
     result = ((float)Math.Atan2(-vec.Y, vec.X)) % MathUtilities.Pi2;
 }
示例#9
0
 public static void Angle(ref Vector2 vector, out float result)
 {
     var vec = vector.Normalize();
     float val = vec.X;
     val = (val > 1) ? 1 : val;
     val = (val < -1) ? -1 : val;
     result = (float)Math.Acos(val);
 }