daily update on 202303006 by nitload youmu

This commit is contained in:
Nitload
2023-03-07 00:59:55 +08:00
parent df2af2b2d5
commit 873c408cd4
20 changed files with 291 additions and 19 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
+48 -15
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
@@ -60,23 +61,14 @@ namespace StgSharp.Math
}
}
public static unsafe Array2x2 operator *(Array2x2 array1, Array2x2 array2)
public override int GetHashCode()
{
float* p = &array1.row1.X;
return HashCode.Combine(row1,row2);
}
Vec2D colum1 = new Vec2D(
*p , *(p + 2)
);
Vec2D colum2 = new Vec2D(
*(p + 1), *(p + 3)
);
return new Array2x2(
colum1 * array2.row1,
colum2 * array2.row1,
colum1 * array2.row2,
colum2 * array2.row2
);
public override string ToString()
{
return $"{row1}\n{row2}";
}
public static Array2x2 operator +(Array2x2 array1, Array2x2 array2)
@@ -95,6 +87,47 @@ namespace StgSharp.Math
);
}
public static unsafe Array2x2 operator *(Array2x2 array1, Array2x2 array2)
{
float* a11 = &array1.row1.X;
float* a12 = a11++ ;
float* a21 = a12++ ;
float* a22 = a21++ ;
float* b11 = &array2.row1.X ;
float* b12 = b11++ ;
float* b21 = b12++ ;
float* b22 = b21++ ;
var s1 = *a21 + *a22;
var s2 = s1 - *a11;
var s3 = *a11 - *a21;
var s4 = *a12 - s2;
var t1 = *b12 - *b11;
var t2 = *b22 - t1;
var t3 = *b22 - *b12;
var t4 = t2 - *b21;
var m1 = *a11 * *b11;
var m2 = *a12 * *b11;
var m3 = s4 * *b22;
var m4 = *a22 * t4;
var m5 = s1 * t1;
var m6 = s2 * t2;
var m7 = s3 * t3;
var u1 = m1 + m2;
var u2 = m1 + m6;
var u3 = u2 + m7;
var u4 = u2 + m5;
var u5 = u4 + m3;
var u6 = u3 - m4;
var u7 = u3 + m5;
return new Array2x2(u1,u5,u6,u7);
}
}
}
+47 -2
View File
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.Math
@@ -66,9 +67,53 @@ namespace StgSharp.Math
}
}
public static Array4x4 operator *(Array4x2 array1, Array2x4 array2)
public static unsafe Array4x4 operator *(Array4x2 array1, Array2x4 array2)
{
return default(Array4x4);
float* p1 = &array1.row1.X;
float* p2 = &array2.row1.X;
Colum2D a11 = new Colum2D(*(p1 + 0), *(p1 + 2));
Colum2D a12 = new Colum2D(*(p1 + 1), *(p1 + 3));
Colum2D a21 = new Colum2D(*(p1 + 4), *(p1 + 6));
Colum2D a22 = new Colum2D(*(p1 + 5), *(p1 + 7));
Vec2D b11 = new Vec2D(*(p2 + 0), *(p2 + 1));
Vec2D b12 = new Vec2D(*(p2 + 2), *(p2 + 3));
Vec2D b21 = new Vec2D(*(p2 + 4), *(p2 + 5));
Vec2D b22 = new Vec2D(*(p2 + 6), *(p2 + 7));
var s1 = a21 + a22;
var s2 = s1 - a11;
var s3 = a11 - a21;
var s4 = a12 - s2;
var t1 = b12 - b11;
var t2 = b22 - t1;
var t3 = b22 - b12;
var t4 = t2 - b21;
var m1 = a11 * b11;
var m2 = a12 * b11;
var m3 = s4 * b22;
var m4 = a22 * t4;
var m5 = s1 * t1;
var m6 = s2 * t2;
var m7 = s3 * t3;
var u1 = m1 + m2;
var u2 = m1 + m6;
var u3 = u2 + m7;
var u4 = u2 + m5;
var u5 = u4 + m3;
var u6 = u3 - m4;
var u7 = u3 + m5;
return new Array4x4(
new Vec4D(u1.row1, u5.row1),
new Vec4D(u1.row2, u5.row2),
new Vec4D(u6.row1, u7.row1),
new Vec4D(u6.row2, u7.row2)
);
}
}
+81 -1
View File
@@ -67,8 +67,88 @@ namespace StgSharp.Math
{
return $"{this.row1}\n{this.row2}\n{this.row3}\n{this.row4}";
}
public static Array4x4 operator +(Array4x4 array1, Array4x4 array2)
{
return new Array4x4(
array1.row1 + array2.row1,
array1.row2 + array2.row2,
array1.row3 + array2.row3,
array1.row4 + array2.row4
);
}
public static Array4x4 operator -(Array4x4 array1, Array4x4 array2)
{
return new Array4x4(
array1.row1 - array2.row1,
array1.row2 - array2.row2,
array1.row3 - array2.row3,
array1.row4 - array2.row4
);
}
public static Array4x4 operator *(Array4x4 array, float x)
{
return new Array4x4(
array.row1 * x,
array.row2 * x,
array.row3 * x,
array.row4 * x
);
}
public static unsafe Array4x4 operator *(Array4x4 array1, Array4x4 array2)
{
float* p1 = &array1.row1.X;
float* p2 = &array2.row1.X;
Array2x2 a11 = new Array2x2(*p1,*(p1 + 1),*(p1 + 4),*(p1 + 5));
Array2x2 a12 = new Array2x2(*(p1 + 2), *(p1 + 3),*(p1 + 6),*(p1 + 7));
Array2x2 a21 = new Array2x2(*(p1 + 8), *(p1 + 9),*(p1 + 12),*(p1 + 13));
Array2x2 a22 = new Array2x2(*(p1 + 10), *(p1 + 11),*(p1 + 14),*(p1 + 15));
Array2x2 b11 = new Array2x2(*p1, *(p1 + 1), *(p1 + 4), *(p1 + 5));
Array2x2 b12 = new Array2x2(*(p1 + 2), *(p1 + 3), *(p1 + 6), *(p1 + 7));
Array2x2 b21 = new Array2x2(*(p1 + 8), *(p1 + 9), *(p1 + 12), *(p1 + 13));
Array2x2 b22 = new Array2x2(*(p1 + 10), *(p1 + 11), *(p1 + 14), *(p1 + 15));
var s1 = a21 + a22;
var s2 = s1 - a11;
var s3 = a11 - a21;
var s4 = a12 - s2;
var t1 = b12 - b11;
var t2 = b22 - t1;
var t3 = b22 - b12;
var t4 = t2 - b21;
var m1 = a11 * b11;
var m2 = a12 * b11;
var m3 = s4 * b22;
var m4 = a22 * t4;
var m5 = s1 * t1;
var m6 = s2 * t2;
var m7 = s3 * t3;
var u1 = m1 + m2;
var u2 = m1 + m6;
var u3 = u2 + m7;
var u4 = u2 + m5;
var u5 = u4 + m3;
var u6 = u3 - m4;
var u7 = u3 + m5;
return new Array4x4(
new Vec4D(u1.row1,u5.row1),
new Vec4D(u1.row2,u5.row2),
new Vec4D(u6.row1,u7.row1),
new Vec4D(u6.row2,u7.row2)
);
}
}
}
+94
View File
@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace StgSharp.Math
{
[StructLayout(LayoutKind.Explicit)]
public struct Colum2D:IEquatable<Colum2D>
{
[FieldOffset(0)]
public float X;
[FieldOffset(4)]
public float Y;
public Colum2D(float x,float y)
{
X= x;
Y= y;
}
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
else if (obj.GetType() != typeof(Colum2D))
{
return false;
}
else
{
return this.Equals((Colum2D)obj);
}
}
bool IEquatable<Colum2D>.Equals(Colum2D other)
{
if (this.GetHashCode() != other.GetHashCode())
{
return false;
}
else
{
return X == other.X && Y == other.Y;
}
}
public override int GetHashCode()
{
return HashCode.Combine(X,Y);
}
public override string ToString()
{
return $"{X}\n{Y}";
}
public static Colum2D operator +(Colum2D c1,Colum2D c2)
{
return new Colum2D(
c1.X + c2.X,
c1.Y + c2.Y
);
}
public static Colum2D operator -(Colum2D c1, Colum2D c2)
{
return new Colum2D(
c1.X - c2.X,
c1.Y - c2.Y
);
}
public static Array2x2 operator *(Colum2D colum, Vec2D vec)
{
return new Array2x2(
colum.X * vec.X, colum.X * vec.Y,
colum.Y * vec.X, colum.Y * vec.Y
);
}
public static Colum2D operator *(Colum2D colum, float x)
{
return new Colum2D(colum.X * x,colum.Y * x);
}
public static Colum2D operator /(Colum2D colum, float x)
{
return new Colum2D(colum.X / x, colum.Y / x);
}
}
}
+11
View File
@@ -36,6 +36,17 @@ namespace StgSharp.Math
W = w;
}
public Vec4D(Vec2D p1,Vec2D p2)
{
X= 0;
Y= 0;
Z = 0;
W = 0;
Point1= p1;
Point2 = p2;
}
public override bool Equals(object obj)
{
if (obj == null)
@@ -1 +1 @@
0fc25006e106f23a3259d14620e7ae6858fe601c
f462f03e342399957b6cf64914e0bf4b0a78ac84
@@ -22,3 +22,12 @@ D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\Stg
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\refint\StgSharp.dll
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.xml
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\ref\StgSharp.dll
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\StgSharp.csproj.AssemblyReference.cache
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\StgSharp.GeneratedMSBuildEditorConfig.editorconfig
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\StgSharp.AssemblyInfoInputs.cache
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\StgSharp.AssemblyInfo.cs
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\StgSharp.csproj.CoreCompileInputs.cache
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\StgSharp.dll
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\refint\StgSharp.dll
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\StgSharp.xml
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\Debug\netstandard2.1\StgSharp.pdb