daily update on 20230219 by nitload youmu, vec3d added

This commit is contained in:
Nitload
2023-02-20 00:03:23 +08:00
parent 3762a2e5ce
commit 770150767b
16 changed files with 124 additions and 7 deletions
Binary file not shown.
+1 -2
View File
@@ -1,5 +1,4 @@
using StgSharp;
using StgSharp.Vector;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
+7 -1
View File
@@ -6,6 +6,12 @@ namespace StgSharp
{
public class Launcher
{
internal Partical _bullet;
public Partical Bullet
{
get { return _bullet; }
set { _bullet = value; }
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
using StgSharp.Vector;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
@@ -1,10 +1,9 @@
using StgSharp.Math;
using System;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;
namespace StgSharp.Vector
namespace StgSharp.Math
{
public struct Vec2D:IEquatable<Vec2D>
{
@@ -98,5 +97,6 @@ namespace StgSharp.Vector
{
return this.X * others.Y - this.Y * others.X;
}
}
}
+112
View File
@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;
namespace StgSharp.Math
{
public struct Vec3D : IEquatable<Vec3D>
{
public float X;
public float Y;
public float Z;
public Vec3D(float x, float y, float z)
{
X = x;
Y = y;
Z = z;
}
bool IEquatable<Vec3D>.Equals(Vec3D other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return this.X == other.X
&& this.Y == other.Y
&& this.Z == other.Z;
}
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(Vec3D))
{
return false;
}
else
{
return this.Equals((Vec3D)obj);
}
}
public override int GetHashCode()
{
return HashCode.Combine(X, Y, Z);
}
public override string ToString()
{
return $"{X},{Y},{Z}";
}
public static bool operator ==(Vec3D vec1,Vec3D vec2)
{
return vec1.X == vec2.X
&& vec1.Y == vec2.Y
&& vec1.Z == vec2.Z;
}
public static bool operator !=(Vec3D vec1, Vec3D vec2)
{
return !(vec1.X == vec2.X
&& vec1.Y == vec2.Y
&& vec1.Z == vec2.Z);
}
public static Vec3D operator +(Vec3D vec1, Vec3D vec2)
{
return new Vec3D(
vec1.X + vec2.X,
vec1.Y + vec2.Y,
vec1.Z + vec2.Z
);
}
public static Vec3D operator -(Vec3D vec1, Vec3D vec2)
{
return new Vec3D(
vec1.X - vec2.X,
vec1.Y - vec2.Y,
vec1.Z - vec2.Z
);
}
public static Vec3D operator *(Vec3D vec, float x)
{
return new Vec3D(
vec.X * x,
vec.Y * x,
vec.Z * x
);
}
public static Vec3D operator /(Vec3D vec, float x)
{
return new Vec3D(
vec.X / x,
vec.Y / x,
vec.Z / x
);
}
}
}