Skip to content

Commit

Permalink
Add to C#
Browse files Browse the repository at this point in the history
  • Loading branch information
AThousandShips committed Aug 3, 2023
1 parent aee3d98 commit a3560b6
Show file tree
Hide file tree
Showing 6 changed files with 204 additions and 0 deletions.
32 changes: 32 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,38 @@ public readonly Vector2 LimitLength(real_t length = 1.0f)
return v;
}

/// <summary>
/// Returns the result of the component-wise maximum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector2(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting maximum vector.</returns>
public readonly Vector2 Max(Vector2 with)
{
return new Vector2
(
Mathf.Max(X, with.X),
Mathf.Max(Y, with.Y)
);
}

/// <summary>
/// Returns the result of the component-wise minimum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector2(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting minimum vector.</returns>
public readonly Vector2 Min(Vector2 with)
{
return new Vector2
(
Mathf.Min(X, with.X),
Mathf.Min(Y, with.Y)
);
}

/// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If both components are equal, this method returns <see cref="Axis.X"/>.
Expand Down
32 changes: 32 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,38 @@ public readonly int LengthSquared()
return x2 + y2;
}

/// <summary>
/// Returns the result of the component-wise maximum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector2I(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting maximum vector.</returns>
public readonly Vector2I Max(Vector2I with)
{
return new Vector2I
(
Mathf.Max(X, with.X),
Mathf.Max(Y, with.Y)
);
}

/// <summary>
/// Returns the result of the component-wise minimum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector2I(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting minimum vector.</returns>
public readonly Vector2I Min(Vector2I with)
{
return new Vector2I
(
Mathf.Min(X, with.X),
Mathf.Min(Y, with.Y)
);
}

/// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If both components are equal, this method returns <see cref="Axis.X"/>.
Expand Down
34 changes: 34 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,40 @@ public readonly Vector3 LimitLength(real_t length = 1.0f)
return v;
}

/// <summary>
/// Returns the result of the component-wise maximum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector3(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting maximum vector.</returns>
public readonly Vector3 Max(Vector3 with)
{
return new Vector3
(
Mathf.Max(X, with.X),
Mathf.Max(Y, with.Y),
Mathf.Max(Z, with.Z)
);
}

/// <summary>
/// Returns the result of the component-wise minimum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector3(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting minimum vector.</returns>
public readonly Vector3 Min(Vector3 with)
{
return new Vector3
(
Mathf.Min(X, with.X),
Mathf.Min(Y, with.Y),
Mathf.Min(Z, with.Z)
);
}

/// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.X"/>.
Expand Down
34 changes: 34 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,40 @@ public readonly int LengthSquared()
return x2 + y2 + z2;
}

/// <summary>
/// Returns the result of the component-wise maximum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector3I(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting maximum vector.</returns>
public readonly Vector3I Max(Vector3I with)
{
return new Vector3I
(
Mathf.Max(X, with.X),
Mathf.Max(Y, with.Y),
Mathf.Max(Z, with.Z)
);
}

/// <summary>
/// Returns the result of the component-wise minimum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector3I(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting minimum vector.</returns>
public readonly Vector3I Min(Vector3I with)
{
return new Vector3I
(
Mathf.Min(X, with.X),
Mathf.Min(Y, with.Y),
Mathf.Min(Z, with.Z)
);
}

/// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.X"/>.
Expand Down
36 changes: 36 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,42 @@ public readonly Vector4 Lerp(Vector4 to, real_t weight)
);
}

/// <summary>
/// Returns the result of the component-wise maximum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector4(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z), Mathf.Max(W, with.W))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting maximum vector.</returns>
public readonly Vector4 Max(Vector4 with)
{
return new Vector4
(
Mathf.Max(X, with.X),
Mathf.Max(Y, with.Y),
Mathf.Max(Z, with.Z),
Mathf.Max(W, with.W)
);
}

/// <summary>
/// Returns the result of the component-wise minimum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector4(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z), Mathf.Min(W, with.W))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting minimum vector.</returns>
public readonly Vector4 Min(Vector4 with)
{
return new Vector4
(
Mathf.Min(X, with.X),
Mathf.Min(Y, with.Y),
Mathf.Min(Z, with.Z),
Mathf.Min(W, with.W)
);
}

/// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.X"/>.
Expand Down
36 changes: 36 additions & 0 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,42 @@ public readonly int LengthSquared()
return x2 + y2 + z2 + w2;
}

/// <summary>
/// Returns the result of the component-wise maximum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector4I(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z), Mathf.Max(W, with.W))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting maximum vector.</returns>
public readonly Vector4I Max(Vector4I with)
{
return new Vector4I
(
Mathf.Max(X, with.X),
Mathf.Max(Y, with.Y),
Mathf.Max(Z, with.Z),
Mathf.Max(W, with.W)
);
}

/// <summary>
/// Returns the result of the component-wise minimum between
/// this vector and <paramref name="with"/>.
/// Equivalent to <c>new Vector4I(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z), Mathf.Min(W, with.W))</c>.
/// </summary>
/// <param name="with">The other vector to use.</param>
/// <returns>The resulting minimum vector.</returns>
public readonly Vector4I Min(Vector4I with)
{
return new Vector4I
(
Mathf.Min(X, with.X),
Mathf.Min(Y, with.Y),
Mathf.Min(Z, with.Z),
Mathf.Min(W, with.W)
);
}

/// <summary>
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
/// If all components are equal, this method returns <see cref="Axis.X"/>.
Expand Down

0 comments on commit a3560b6

Please sign in to comment.