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; }
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); }
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); }
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; }
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; }
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; }
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; }
public static void Angle180(ref Vector2 vector, out float result) { var vec = vector.Normalize(); result = ((float)Math.Atan2(-vec.Y, vec.X)) % MathUtilities.Pi2; }
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); }