enmergent commit on 20230213 by nitload youmu, recovery of math functions
This commit is contained in:
@@ -1,34 +1,82 @@
|
||||
using System;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Vector
|
||||
{
|
||||
public struct Vec2x1:IEquatable<Vec2x1>
|
||||
public struct Vec2D:IEquatable<Vec2D>
|
||||
{
|
||||
float a1;
|
||||
float a2;
|
||||
float X;
|
||||
float Y;
|
||||
float Direction;
|
||||
float Length;
|
||||
|
||||
public Vec2x1(float x,float y)
|
||||
public Vec2D(float x,float y)
|
||||
{
|
||||
a1 = x;
|
||||
a2 = y;
|
||||
X = x;
|
||||
Y = y;
|
||||
Direction = 0;
|
||||
}
|
||||
|
||||
public bool Equals(Vec2x1 other)
|
||||
public bool Equals(Vec2D other)
|
||||
{
|
||||
return true;
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.X == other.X && this.Y == other.Y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static bool operator ==(Vec2x1 vec1, Vec2x1 vec2)
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return true;
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Vec2D))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec2D)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator !=(Vec2x1 vec1, Vec2x1 vec2)
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return false;
|
||||
return HashCode.Combine(X, Y);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.X},{this.Y}";
|
||||
}
|
||||
|
||||
public static bool operator ==(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return vec1.X==vec2.X && vec1.Y==vec2.Y;
|
||||
}
|
||||
|
||||
public static bool operator !=(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return !(vec1.X == vec2.X && vec1.Y == vec2.Y);
|
||||
}
|
||||
|
||||
public static Vec2D operator +(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return new Vec2D(vec1.X + vec2.X, vec1.Y + vec2.Y);
|
||||
}
|
||||
|
||||
public static Vec2D operator -(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return new Vec2D(vec1.X + vec2.X, vec1.Y + vec2.Y);
|
||||
}
|
||||
|
||||
public static
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user