New IO structure, unexpexted error in C code
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct matrix3x3:IEquatable<matrix3x3>
|
||||
public struct matrix3x3 : IEquatable<matrix3x3>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public vec3d row1;
|
||||
@@ -16,7 +13,7 @@ namespace StgSharp.Math
|
||||
[FieldOffset(24)]
|
||||
public vec3d row3;
|
||||
|
||||
public matrix3x3(vec3d r0,vec3d r1,vec3d r2)
|
||||
public matrix3x3(vec3d r0, vec3d r1, vec3d r2)
|
||||
{
|
||||
row1 = r0;
|
||||
row2 = r1;
|
||||
@@ -24,9 +21,9 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
public matrix3x3(
|
||||
float a11,float a12,float a13,
|
||||
float a21,float a22,float a23,
|
||||
float a31,float a32,float a33
|
||||
float a11, float a12, float a13,
|
||||
float a21, float a22, float a23,
|
||||
float a31, float a32, float a33
|
||||
)
|
||||
{
|
||||
row1 = new vec3d(a11, a12, a13);
|
||||
@@ -36,12 +33,12 @@ namespace StgSharp.Math
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(row1,row2,row3);
|
||||
return HashCode.Combine(row1, row2, row3);
|
||||
}
|
||||
|
||||
bool IEquatable<matrix3x3>.Equals(matrix3x3 other)
|
||||
{
|
||||
if (this.GetHashCode()!=other.GetHashCode())
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -75,7 +72,7 @@ namespace StgSharp.Math
|
||||
return $"{row1}\n{row2}\n{row3}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static bool operator ==(matrix3x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
@@ -90,16 +87,16 @@ namespace StgSharp.Math
|
||||
public static matrix3x3 operator +(matrix3x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
return new matrix3x3(
|
||||
matrix1.row1.X + matrix2.row1.X,
|
||||
matrix1.row1.Y + matrix2.row1.Y,
|
||||
matrix1.row1.X + matrix2.row1.X,
|
||||
matrix1.row1.Y + matrix2.row1.Y,
|
||||
matrix1.row1.Z + matrix2.row1.Z,
|
||||
|
||||
matrix1.row2.X + matrix2.row2.X,
|
||||
matrix1.row2.Y + matrix2.row2.Y,
|
||||
matrix1.row2.X + matrix2.row2.X,
|
||||
matrix1.row2.Y + matrix2.row2.Y,
|
||||
matrix1.row2.Z + matrix2.row2.Z,
|
||||
|
||||
matrix1.row3.X + matrix2.row3.X,
|
||||
matrix1.row3.Y + matrix2.row3.Y,
|
||||
matrix1.row3.X + matrix2.row3.X,
|
||||
matrix1.row3.Y + matrix2.row3.Y,
|
||||
matrix1.row3.Z + matrix2.row3.Z
|
||||
);
|
||||
}
|
||||
@@ -121,7 +118,7 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static matrix3x3 operator *(matrix3x3 array, float x)
|
||||
{
|
||||
@@ -129,15 +126,15 @@ namespace StgSharp.Math
|
||||
array.row1 * x,
|
||||
array.row2 * x,
|
||||
array.row3 * x
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
public static matrix3x3 operator /(matrix3x3 array, float x)
|
||||
{
|
||||
return new matrix3x3(
|
||||
array.row1/x,
|
||||
array.row2/x,
|
||||
array.row3/x
|
||||
array.row1 / x,
|
||||
array.row2 / x,
|
||||
array.row3 / x
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user