@@ -782,11 +782,25 @@ public override string ToString()
782782 /// become (X, Z) in the resulting vector, with the provided Z parameter assigned to Y.
783783 /// </returns>
784784 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
785- public Vector3d ToVector3d ( Fixed64 z )
785+ public readonly Vector3d ToVector3d ( Fixed64 z )
786786 {
787787 return new Vector3d ( x , z , y ) ;
788788 }
789789
790+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
791+ public readonly void Deconstruct ( out float x , out float y )
792+ {
793+ x = this . x . ToPreciseFloat ( ) ;
794+ y = this . y . ToPreciseFloat ( ) ;
795+ }
796+
797+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
798+ public readonly void Deconstruct ( out int x , out int y )
799+ {
800+ x = this . x . RoundToInt ( ) ;
801+ y = this . y . RoundToInt ( ) ;
802+ }
803+
790804 /// <summary>
791805 /// Converts each component of the vector from radians to degrees.
792806 /// </summary>
@@ -831,6 +845,36 @@ public static Vector2d ToRadians(Vector2d degrees)
831845 return new Vector2d ( v1 . x + mag , v1 . y + mag ) ;
832846 }
833847
848+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
849+ public static Vector2d operator + ( Fixed64 mag , Vector2d v1 )
850+ {
851+ return v1 + mag ;
852+ }
853+
854+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
855+ public static Vector2d operator + ( Vector2d v1 , ( int x , int y ) v2 )
856+ {
857+ return new Vector2d ( v1 . x + v2 . x , v1 . y + v2 . y ) ;
858+ }
859+
860+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
861+ public static Vector2d operator + ( ( int x , int y ) v2 , Vector2d v1 )
862+ {
863+ return v1 + v2 ;
864+ }
865+
866+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
867+ public static Vector2d operator + ( Vector2d v1 , ( float x , float y ) v2 )
868+ {
869+ return new Vector2d ( v1 . x + v2 . x , v1 . y + v2 . y ) ;
870+ }
871+
872+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
873+ public static Vector2d operator + ( ( float x , float y ) v1 , Vector2d v2 )
874+ {
875+ return v2 + v1 ;
876+ }
877+
834878 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
835879 public static Vector2d operator - ( Vector2d v1 , Vector2d v2 )
836880 {
@@ -843,6 +887,36 @@ public static Vector2d ToRadians(Vector2d degrees)
843887 return new Vector2d ( v1 . x - mag , v1 . y - mag ) ;
844888 }
845889
890+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
891+ public static Vector2d operator - ( Fixed64 mag , Vector2d v1 )
892+ {
893+ return new Vector2d ( mag - v1 . x , mag - v1 . y ) ;
894+ }
895+
896+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
897+ public static Vector2d operator - ( Vector2d v1 , ( int x , int y ) v2 )
898+ {
899+ return new Vector2d ( v1 . x - v2 . x , v1 . y - v2 . y ) ;
900+ }
901+
902+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
903+ public static Vector2d operator - ( ( int x , int y ) v1 , Vector2d v2 )
904+ {
905+ return new Vector2d ( v1 . x - v2 . x , v1 . y - v2 . y ) ;
906+ }
907+
908+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
909+ public static Vector2d operator - ( Vector2d v1 , ( float x , float y ) v2 )
910+ {
911+ return new Vector2d ( v1 . x - v2 . x , v1 . y - v2 . y ) ;
912+ }
913+
914+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
915+ public static Vector2d operator - ( ( float x , float y ) v1 , Vector2d v2 )
916+ {
917+ return new Vector2d ( v1 . x - v2 . x , v1 . y - v2 . y ) ;
918+ }
919+
846920 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
847921 public static Vector2d operator - ( Vector2d v1 )
848922 {
@@ -900,7 +974,7 @@ public bool NotZero()
900974 }
901975
902976 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
903- public override bool Equals ( object obj )
977+ public override bool Equals ( object ? obj )
904978 {
905979 return obj is Vector2d other && Equals ( other ) ;
906980 }
0 commit comments