daily update on 20230302 by nitload youmu
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Array2x4 : IEquatable<Array2x4>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec4D row1;
|
||||
[FieldOffset(16)]
|
||||
public Vec4D row2;
|
||||
|
||||
public Array2x4(Vec4D r1,Vec4D r2)
|
||||
{
|
||||
row1 = r1;
|
||||
row2 = r2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public bool Equals(Array2x4 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.row1 == other.row1
|
||||
&& this.row2 == other.row2;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Array2x4))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Array2x4)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(this.row1, this.row2);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.row1}\n{this.row2}";
|
||||
}
|
||||
|
||||
public static Array2x4 operator +(Array2x4 array1,Array2x4 array2)
|
||||
{
|
||||
return new Array2x4(
|
||||
array1.row1 + array2.row1,
|
||||
array1.row2 + array2.row2
|
||||
) ;
|
||||
}
|
||||
|
||||
public static Array2x4 operator -(Array2x4 array1, Array2x4 array2)
|
||||
{
|
||||
return new Array2x4(
|
||||
array1.row1 - array2.row1,
|
||||
array1.row2 - array2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Array2x4 operator *(Array2x4 array, float x)
|
||||
{
|
||||
return new Array2x4(
|
||||
array.row1 * x,
|
||||
array.row2 * x
|
||||
);
|
||||
}
|
||||
|
||||
public static Array2x4 operator /(Array2x4 array, float x)
|
||||
{
|
||||
return new Array2x4(
|
||||
array.row1 / x,
|
||||
array.row2 / x
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Array2x2 operator *(Array2x4 array1, Array4x2 array2)
|
||||
{
|
||||
float* p1 = &array1.row1.X;
|
||||
float* p2 = &array2.row2.X;
|
||||
|
||||
return new Array2x2(
|
||||
*(p1 + 0) * *(p2 + 0)+ *(p1 + 1) * *(p2 + 2)+ *(p1 + 2) * *(p2 + 4)+ *(p1 + 3) * *(p2 + 6),
|
||||
*(p1 + 0) * *(p2 + 1)+ *(p1 + 1) * *(p2 + 3)+ *(p1 + 2) * *(p2 + 5)+ *(p1 + 3) * *(p2 + 7),
|
||||
*(p1 + 4) * *(p2 + 0)+ *(p1 + 5) * *(p2 + 2)+ *(p1 + 6) * *(p2 + 4)+ *(p1 + 7) * *(p2 + 6),
|
||||
*(p1 + 4) * *(p2 + 1)+ *(p1 + 5) * *(p2 + 3)+ *(p1 + 6) * *(p2 + 5)+ *(p1 + 7) * *(p2 + 7)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Array4x2:IEquatable<Array4x2>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec2D row1;
|
||||
[FieldOffset(8)]
|
||||
public Vec2D row2;
|
||||
[FieldOffset(16)]
|
||||
public Vec2D row3;
|
||||
[FieldOffset(24)]
|
||||
public Vec2D row4;
|
||||
|
||||
public Array4x2(Vec2D r1, Vec2D r2, Vec2D r3, Vec2D r4)
|
||||
{
|
||||
row1 = r1;
|
||||
row2 = r2;
|
||||
row3 = r3;
|
||||
row4 = r4;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() == typeof(Array4x2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Array4x2)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(row1, row2, row3, row4);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{row1}\n{row2}\n{row3}\n{row4}";
|
||||
}
|
||||
|
||||
bool IEquatable<Array4x2>.Equals(Array4x2 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.row1 == other.row1
|
||||
&& this.row2 == other.row2
|
||||
&& this.row3 == other.row3
|
||||
&& this.row4 == other.row4;
|
||||
}
|
||||
}
|
||||
|
||||
public static Array4x4 operator *(Array4x2 array1, Array2x4 array2)
|
||||
{
|
||||
return default(Array4x4);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Array4x4:IEquatable<Array4x4>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec4D row1;
|
||||
[FieldOffset(16)]
|
||||
public Vec4D row2;
|
||||
[FieldOffset(32)]
|
||||
public Vec4D row3;
|
||||
[FieldOffset(48)]
|
||||
public Vec4D row4;
|
||||
|
||||
public Array4x4(Vec4D r1, Vec4D r2, Vec4D r3, Vec4D r4)
|
||||
{
|
||||
row1 = r1;
|
||||
row2 = r2;
|
||||
row3 = r3;
|
||||
row4 = r4;
|
||||
}
|
||||
|
||||
public Array4x4(
|
||||
float a11, float a12, float a13, float a14,
|
||||
float a21, float a22, float a23, float a24,
|
||||
float a31, float a32, float a33, float a34,
|
||||
float a41, float a42, float a43, float a44
|
||||
)
|
||||
{
|
||||
row1 = new Vec4D(a11, a12, a13, a14);
|
||||
row2 = new Vec4D(a11, a12, a13, a14);
|
||||
row3 = new Vec4D(a11, a12, a13, a14);
|
||||
row4 = new Vec4D(a11, a12, a13, a14);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
bool IEquatable<Array4x4>.Equals(Array4x4 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.row1 == other.row1
|
||||
&& this.row2 == other.row2
|
||||
&& this.row3 == other.row3
|
||||
&& this.row4 == other.row4;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(row1, row2, row3, row4);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.row1}\n{this.row2}\n{this.row3}\n{this.row4}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
internal class Cordination
|
||||
{
|
||||
}
|
||||
|
||||
public enum CordinatePlain
|
||||
{
|
||||
XY,
|
||||
YZ,
|
||||
XZ,
|
||||
}
|
||||
}
|
||||
@@ -95,9 +95,6 @@ namespace StgSharp.Math
|
||||
return new Vec2D(vec.X/x, vec.Y/x);
|
||||
}
|
||||
|
||||
public Vec3D to3D()
|
||||
{
|
||||
return new Vec3D(this.X, this.Y, 0.0f);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
public static float Det(Array2x2 array)
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
public static float GetAngle(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
public static float GetLength(this Vec3D vec)
|
||||
{
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
public static Vec2D GetVector(Vec4D pointPair)
|
||||
{
|
||||
return pointPair.Point2-pointPair.Point1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
public static Vec3D To3D(this Vec2D vec)
|
||||
{
|
||||
return new Vec3D(vec.X, vec.Y, 0.0f);
|
||||
}
|
||||
|
||||
public static Vec4D To4D(this Vec2D Vec)
|
||||
{
|
||||
return new Vec4D(Vec.X, Vec.Y, 0, 0);
|
||||
}
|
||||
|
||||
public static Vec4D To4D(this Vec3D vec)
|
||||
{
|
||||
return new Vec4D(vec.X, vec.Y, vec.Z, 0);
|
||||
}
|
||||
|
||||
public static Vec2D To2D(Vec3D vec, CordinatePlain plain)
|
||||
{
|
||||
switch (plain)
|
||||
{
|
||||
case CordinatePlain.XY:
|
||||
return new Vec2D(vec.X, vec.Y);
|
||||
break;
|
||||
case CordinatePlain.YZ:
|
||||
return new Vec2D(vec.Y, vec.Z);
|
||||
break;
|
||||
case CordinatePlain.XZ:
|
||||
return new Vec2D(vec.X, vec.Z);
|
||||
break;
|
||||
default:
|
||||
return default(Vec2D);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
public static float Cross(Vec2D vec1, Vec2D vec2)
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = StgSharp
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\
|
||||
|
||||
Binary file not shown.
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj": {}
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj",
|
||||
"projectName": "StgSharp",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj",
|
||||
"packagesPath": "C:\\Users\\Nitlo\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\obj\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
|
||||
@@ -192,11 +192,11 @@
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj",
|
||||
"projectName": "StgSharp",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj",
|
||||
"packagesPath": "C:\\Users\\Nitlo\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\obj\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "D2b6GMfOY4aZxUai0LnRuWyULH+CEG98xFRXi9OAg3hVh5QYpI8wa9Penb+96fBCHHpWEQ22IzA65zYWs4fy2g==",
|
||||
"dgSpecHash": "5G3NWQf7wV5PLr5m1b580Wd0sIPC7CL1BaPzPPQflu8N6pnZ3hZTMxEXjj+C3TF5fOTJ1U9gMowOkb8ftV/V0g==",
|
||||
"success": true,
|
||||
"projectFilePath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"projectFilePath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\Nitlo\\.nuget\\packages\\glfwdotnet\\20.9.0\\glfwdotnet.20.9.0.nupkg.sha512",
|
||||
"C:\\Users\\Nitlo\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512",
|
||||
|
||||
Reference in New Issue
Block a user