diff --git a/源代码/.vs/ProjectEvaluation/stgsharp.metadata.v5.1 b/源代码/.vs/ProjectEvaluation/stgsharp.metadata.v5.1 index e10b177c..da6d6604 100644 Binary files a/源代码/.vs/ProjectEvaluation/stgsharp.metadata.v5.1 and b/源代码/.vs/ProjectEvaluation/stgsharp.metadata.v5.1 differ diff --git a/源代码/.vs/ProjectEvaluation/stgsharp.projects.v5.1 b/源代码/.vs/ProjectEvaluation/stgsharp.projects.v5.1 index f0a0858d..0de57473 100644 Binary files a/源代码/.vs/ProjectEvaluation/stgsharp.projects.v5.1 and b/源代码/.vs/ProjectEvaluation/stgsharp.projects.v5.1 differ diff --git a/源代码/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 b/源代码/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 index a5bb0a99..1c45c3ea 100644 Binary files a/源代码/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 and b/源代码/.vs/StgSharp/DesignTimeBuild/.dtbcache.v2 differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/02e605d8-8bb4-4fa5-a768-47173fe610fc.vsidx b/源代码/.vs/StgSharp/FileContentIndex/02e605d8-8bb4-4fa5-a768-47173fe610fc.vsidx new file mode 100644 index 00000000..772fb4f7 Binary files /dev/null and b/源代码/.vs/StgSharp/FileContentIndex/02e605d8-8bb4-4fa5-a768-47173fe610fc.vsidx differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/3088d0c6-a749-4e83-93f4-b3bcc537402c.vsidx b/源代码/.vs/StgSharp/FileContentIndex/3088d0c6-a749-4e83-93f4-b3bcc537402c.vsidx deleted file mode 100644 index 55545a34..00000000 Binary files a/源代码/.vs/StgSharp/FileContentIndex/3088d0c6-a749-4e83-93f4-b3bcc537402c.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/38a68dbb-54c1-4c57-b638-8c3ecf565224.vsidx b/源代码/.vs/StgSharp/FileContentIndex/38a68dbb-54c1-4c57-b638-8c3ecf565224.vsidx new file mode 100644 index 00000000..00e16596 Binary files /dev/null and b/源代码/.vs/StgSharp/FileContentIndex/38a68dbb-54c1-4c57-b638-8c3ecf565224.vsidx differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/78b6b399-b415-41ca-80bd-ceb57e029f8f.vsidx b/源代码/.vs/StgSharp/FileContentIndex/78b6b399-b415-41ca-80bd-ceb57e029f8f.vsidx deleted file mode 100644 index b7687963..00000000 Binary files a/源代码/.vs/StgSharp/FileContentIndex/78b6b399-b415-41ca-80bd-ceb57e029f8f.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/957be48a-aaba-47ac-a4cf-c44e24507de9.vsidx b/源代码/.vs/StgSharp/FileContentIndex/957be48a-aaba-47ac-a4cf-c44e24507de9.vsidx new file mode 100644 index 00000000..907d985b Binary files /dev/null and b/源代码/.vs/StgSharp/FileContentIndex/957be48a-aaba-47ac-a4cf-c44e24507de9.vsidx differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/a089eeac-2ec9-4831-8a9e-b3d2a3c906b2.vsidx b/源代码/.vs/StgSharp/FileContentIndex/a089eeac-2ec9-4831-8a9e-b3d2a3c906b2.vsidx deleted file mode 100644 index 6586e121..00000000 Binary files a/源代码/.vs/StgSharp/FileContentIndex/a089eeac-2ec9-4831-8a9e-b3d2a3c906b2.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/b7cf57c0-098e-43a9-b7e8-f5ea0a164fb6.vsidx b/源代码/.vs/StgSharp/FileContentIndex/b7cf57c0-098e-43a9-b7e8-f5ea0a164fb6.vsidx new file mode 100644 index 00000000..d7d32529 Binary files /dev/null and b/源代码/.vs/StgSharp/FileContentIndex/b7cf57c0-098e-43a9-b7e8-f5ea0a164fb6.vsidx differ diff --git a/源代码/.vs/StgSharp/FileContentIndex/d35b2eed-856f-44a1-b7ab-9a24e8bfc310.vsidx b/源代码/.vs/StgSharp/FileContentIndex/d35b2eed-856f-44a1-b7ab-9a24e8bfc310.vsidx deleted file mode 100644 index 2d71dc18..00000000 Binary files a/源代码/.vs/StgSharp/FileContentIndex/d35b2eed-856f-44a1-b7ab-9a24e8bfc310.vsidx and /dev/null differ diff --git a/源代码/.vs/StgSharp/v17/.futdcache.v2 b/源代码/.vs/StgSharp/v17/.futdcache.v2 index e51da03f..fff7f7de 100644 Binary files a/源代码/.vs/StgSharp/v17/.futdcache.v2 and b/源代码/.vs/StgSharp/v17/.futdcache.v2 differ diff --git a/源代码/.vs/StgSharp/v17/.suo b/源代码/.vs/StgSharp/v17/.suo index d4768272..5b69acd6 100644 Binary files a/源代码/.vs/StgSharp/v17/.suo and b/源代码/.vs/StgSharp/v17/.suo differ diff --git a/源代码/StgSharp/Vector/Array2x2.cs b/源代码/StgSharp/Vector/Array2x2.cs index 0c226082..22dd69d9 100644 --- a/源代码/StgSharp/Vector/Array2x2.cs +++ b/源代码/StgSharp/Vector/Array2x2.cs @@ -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); + + } } } diff --git a/源代码/StgSharp/Vector/Array4x2.cs b/源代码/StgSharp/Vector/Array4x2.cs index 6e369e56..f75ce298 100644 --- a/源代码/StgSharp/Vector/Array4x2.cs +++ b/源代码/StgSharp/Vector/Array4x2.cs @@ -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) + ); } } diff --git a/源代码/StgSharp/Vector/Array4x4.cs b/源代码/StgSharp/Vector/Array4x4.cs index d2adb134..a6ce9d20 100644 --- a/源代码/StgSharp/Vector/Array4x4.cs +++ b/源代码/StgSharp/Vector/Array4x4.cs @@ -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) + ); + } + } - + } diff --git a/源代码/StgSharp/Vector/Colum2D.cs b/源代码/StgSharp/Vector/Colum2D.cs new file mode 100644 index 00000000..90fba978 --- /dev/null +++ b/源代码/StgSharp/Vector/Colum2D.cs @@ -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 + { + [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.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); + } + } +} diff --git a/源代码/StgSharp/Vector/Vec4D.cs b/源代码/StgSharp/Vector/Vec4D.cs index 6a224953..bfaecb62 100644 --- a/源代码/StgSharp/Vector/Vec4D.cs +++ b/源代码/StgSharp/Vector/Vec4D.cs @@ -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) diff --git a/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache b/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache index c15f63a9..648f0bff 100644 --- a/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache +++ b/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -0fc25006e106f23a3259d14620e7ae6858fe601c +f462f03e342399957b6cf64914e0bf4b0a78ac84 diff --git a/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.FileListAbsolute.txt b/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.FileListAbsolute.txt index dd20c3e3..9d005022 100644 --- a/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.FileListAbsolute.txt +++ b/源代码/StgSharp/obj/Debug/netstandard2.1/StgSharp.csproj.FileListAbsolute.txt @@ -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