Files
stgsharp/源代码/StgSharp/Vector/Array4x2.cs
T

76 lines
1.8 KiB
C#

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);
}
}
}