@@ -782,11 +782,25 @@ public override string ToString()
782
782
/// become (X, Z) in the resulting vector, with the provided Z parameter assigned to Y.
783
783
/// </returns>
784
784
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
785
- public Vector3d ToVector3d ( Fixed64 z )
785
+ public readonly Vector3d ToVector3d ( Fixed64 z )
786
786
{
787
787
return new Vector3d ( x , z , y ) ;
788
788
}
789
789
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
+
790
804
/// <summary>
791
805
/// Converts each component of the vector from radians to degrees.
792
806
/// </summary>
@@ -831,6 +845,36 @@ public static Vector2d ToRadians(Vector2d degrees)
831
845
return new Vector2d ( v1 . x + mag , v1 . y + mag ) ;
832
846
}
833
847
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
+
834
878
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
835
879
public static Vector2d operator - ( Vector2d v1 , Vector2d v2 )
836
880
{
@@ -843,6 +887,36 @@ public static Vector2d ToRadians(Vector2d degrees)
843
887
return new Vector2d ( v1 . x - mag , v1 . y - mag ) ;
844
888
}
845
889
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
+
846
920
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
847
921
public static Vector2d operator - ( Vector2d v1 )
848
922
{
@@ -900,7 +974,7 @@ public bool NotZero()
900
974
}
901
975
902
976
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
903
- public override bool Equals ( object obj )
977
+ public override bool Equals ( object ? obj )
904
978
{
905
979
return obj is Vector2d other && Equals ( other ) ;
906
980
}
0 commit comments