@@ -24,8 +24,14 @@ public partial struct Vector2d : IEquatable<Vector2d>, IComparable<Vector2d>, IE
2424 {
2525 #region Fields and Constants
2626
27+ /// <summary>
28+ /// The X component of the vector.
29+ /// </summary>
2730 public Fixed64 x ;
28-
31+
32+ /// <summary>
33+ /// The Y component of the vector.
34+ /// </summary>
2935 public Fixed64 y ;
3036
3137 /// <summary>
@@ -128,12 +134,16 @@ public Vector2d LeftHandNormal
128134 get => new Vector2d ( y , - x ) ;
129135 }
130136
137+ /// <inheritdoc cref="GetNormalized(Vector2d)"/>
131138 public Vector2d Normal
132139 {
133140 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
134141 get => GetNormalized ( this ) ;
135142 }
136143
144+ /// <summary>
145+ /// Returns the actual length of this vector (RO).
146+ /// </summary>
137147 public Fixed64 Magnitude
138148 {
139149 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
@@ -234,6 +244,7 @@ public Vector2d AddInPlace(Fixed64 xAmount, Fixed64 yAmount)
234244 return this ;
235245 }
236246
247+ /// <inheritdoc cref="AddInPlace(Fixed64, Fixed64)"/>
237248 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
238249 public Vector2d AddInPlace ( Vector2d other )
239250 {
@@ -515,12 +526,19 @@ public Fixed64 Dot(Vector2d other)
515526 return Dot ( other . x , other . y ) ;
516527 }
517528
529+ /// <summary>
530+ /// Computes the cross product magnitude of this vector with another vector.
531+ /// </summary>
532+ /// <param name="otherX">The X component of the other vector.</param>
533+ /// <param name="otherY">The Y component of the other vector.</param>
534+ /// <returns>The cross product magnitude.</returns>
518535 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
519536 public Fixed64 CrossProduct ( Fixed64 otherX , Fixed64 otherY )
520537 {
521538 return x * otherY - y * otherX ;
522539 }
523540
541+ /// <inheritdoc cref="CrossProduct(Fixed64, Fixed64)"/>
524542 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
525543 public Fixed64 CrossProduct ( Vector2d other )
526544 {
@@ -607,12 +625,28 @@ public static Fixed64 GetMagnitude(Vector2d vector)
607625 return temp1 . Abs ( ) > Fixed64 . Zero ? FixedMath . Sqrt ( temp1 ) : Fixed64 . Zero ;
608626 }
609627
628+ /// <summary>
629+ /// Returns a new <see cref="Vector2d"/> where each component is the absolute value of the corresponding input component.
630+ /// </summary>
631+ /// <param name="value">The input vector.</param>
632+ /// <returns>A vector with absolute values for each component.</returns>
610633 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
611634 public static Vector2d Abs ( Vector2d value )
612635 {
613636 return new Vector2d ( value . x . Abs ( ) , value . y . Abs ( ) ) ;
614637 }
615638
639+ /// <summary>
640+ /// Returns a new <see cref="Vector2d"/> where each component is the sign of the corresponding input component.
641+ /// </summary>
642+ /// <param name="value">The input vector.</param>
643+ /// <returns>A vector where each component is -1, 0, or 1 based on the sign of the input.</returns>
644+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
645+ public static Vector2d Sign ( Vector2d value )
646+ {
647+ return new Vector2d ( value . x . Sign ( ) , value . y . Sign ( ) ) ;
648+ }
649+
616650 /// <summary>
617651 /// Creates a vector from a given angle in radians.
618652 /// </summary>
@@ -633,6 +667,10 @@ public static Fixed64 Distance(Vector2d start, Vector2d end)
633667 return start . Distance ( end ) ;
634668 }
635669
670+ /// <summary>
671+ /// Calculates the squared distance between two vectors, avoiding the need for a square root operation.
672+ /// </summary>
673+ /// <returns>The squared distance between the two vectors.</returns>
636674 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
637675 public static Fixed64 SqrDistance ( Vector2d start , Vector2d end )
638676 {
@@ -712,6 +750,15 @@ public override string ToString()
712750 return $ "({ Math . Round ( ( double ) x , 2 ) } , { Math . Round ( ( double ) y , 2 ) } )";
713751 }
714752
753+ /// <summary>
754+ /// Converts this <see cref="Vector2d"/> to a <see cref="Vector3d"/>,
755+ /// mapping the Y component of this vector to the Z axis in the resulting vector.
756+ /// </summary>
757+ /// <param name="z">The value to assign to the Y axis of the resulting <see cref="Vector3d"/>.</param>
758+ /// <returns>
759+ /// A new <see cref="Vector3d"/> where (X, Y) from this <see cref="Vector2d"/>
760+ /// become (X, Z) in the resulting vector, with the provided Z parameter assigned to Y.
761+ /// </returns>
715762 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
716763 public Vector3d ToVector3d ( Fixed64 z )
717764 {
0 commit comments