using System.Collections; using System.Collections.Generic; using Godot; using System.Text; using System; namespace Rokojori { public class Math2D { public static float Dot( Vector2 a, Vector2 b ) { return a.Dot( b ); } public static Vector2 XZ( Vector3 v ) { return new Vector2( v.X, v.Z ); } public static Vector2 Fract( Vector2 a ) { return new Vector2( MathX.Fract( a.X ), MathX.Fract( a.Y ) ); } public static Vector2 SmoothStep( Vector2 a, Vector2 b, Vector2 t ) { var x = MathX.Smoothstep( a.X, b.X, t.X ); var y = MathX.Smoothstep( a.Y, b.Y, t.Y ); return new Vector2( x, y ); } public static Vector2 Rotate90DegreesRight( Vector2 v ) { // 1, 0.5 => -0.5, 1 : -y, x return new Vector2( -v.Y, v.X ); } public static Vector2 Rotate90DegreesLeft( Vector2 v ) { // -0.5, 1 => 1, 0.5 : y, -x return new Vector2( v.Y, -v.X ); } public static Vector2 Rotate90Degrees( Vector2 v, bool clockwise ) { return clockwise ? Rotate90DegreesRight( v ) : Rotate90DegreesLeft( v ); } } }