Godot.Sharp.Extended/Core/Tools/MathFunctionExtensions.cs

22 lines
1.7 KiB
C#
Raw Normal View History

namespace Godot.Sharp.Extended.Tools;
public static partial class MathFunctionExtensions
{
public static bool InRange(this int @this, int min, int max) => @this >= min && @this <= max;
public static bool InRange(this float @this, float min, float max) => @this >= min && @this <= max;
public static bool InRange(this double @this, double min, double max) => @this >= min && @this <= max;
public static bool InRange(this Vector2 @this, Vector2 min, Vector2 max) =>
@this.X.InRange(min.X, max.X) && @this.Y.InRange(min.Y, max.Y);
public static bool InRange(this Vector2I @this, Vector2I min, Vector2I max) =>
@this.X.InRange(min.X, max.X) && @this.Y.InRange(min.Y, max.Y);
public static bool InRange(this Vector3 @this, Vector3 min, Vector3 max) =>
@this.X.InRange(min.X, max.X) && @this.Y.InRange(min.Y, max.Y) && @this.Z.InRange(min.Z, max.Z);
public static bool InRange(this Vector3I @this, Vector3I min, Vector3I max) =>
@this.X.InRange(min.X, max.X) && @this.Y.InRange(min.Y, max.Y) && @this.Z.InRange(min.Z, max.Z);
public static bool InRange(this Vector4 @this, Vector4 min, Vector4 max) =>
@this.X.InRange(min.X, max.X) && @this.Y.InRange(min.Y, max.Y) && @this.Z.InRange(min.Z, max.Z) && @this.W.InRange(min.W, max.W);
public static bool InRange(this Vector4I @this, Vector4I min, Vector4I max) =>
@this.X.InRange(min.X, max.X) && @this.Y.InRange(min.Y, max.Y) && @this.Z.InRange(min.Z, max.Z) && @this.W.InRange(min.W, max.W);
public static bool InRange(this Quaternion @this, Quaternion min, Quaternion max) =>
@this.X.InRange(min.X, max.X) && @this.Y.InRange(min.Y, max.Y) && @this.Z.InRange(min.Z, max.Z) && @this.W.InRange(min.W, max.W);
}