/// <summary>Rotates the vector by an arbitrary angle</summary> /// <param name="vector">Vector to rotate</param> /// <param name="angle">Rotation angle</param> /// <returns>The rotated vector</returns> public static PolarVector2 <ScalarType, MathType> Rotate( PolarVector2 <ScalarType, MathType> vector, double angle ) { return(new PolarVector2 <ScalarType, MathType>( Shared <UncheckedScalarMath> .Instance.Wrap( vector.Phi + angle, 0.0, Trigonometry.Perigon ), vector.Radius )); }
/// <summary>Normalizes the vector to a length of 1</summary> /// <param name="vector">Vector to be normalized</param> /// <returns>The normalized vector</returns> public static PolarVector2 <ScalarType, MathType> Normalize( PolarVector2 <ScalarType, MathType> vector ) { return(new PolarVector2 <ScalarType, MathType>(vector.Phi, math.One)); }
/// <summary>Returns a vector that points into the exact oppsite direction</summary> /// <param name="vector">Vector of which to return the opposite direction</param> /// <returns>The inverted vector</returns> public static PolarVector2 <ScalarType, MathType> operator -( PolarVector2 <ScalarType, MathType> vector ) { return(PolarVector2 <ScalarType, MathType> .Rotate(vector, Trigonometry.Perigon)); }