daily update on 20230320 by nitload youmu
This commit is contained in:
@@ -14,5 +14,8 @@ namespace StgSharp.Control
|
||||
_cache.Next = default(StgSharp.ContainerNode<INode>);
|
||||
_cache.Previous = default(StgSharp.ContainerNode<INode>);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
//对4字节空间的联合体的C#实现
|
||||
[StructLayout(LayoutKind.Explicit, Size = 4)]
|
||||
public struct Union4
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public byte b0;
|
||||
[FieldOffset(1)]
|
||||
public byte b1;
|
||||
[FieldOffset(2)]
|
||||
public byte b2;
|
||||
[FieldOffset(3)]
|
||||
public byte b3;
|
||||
//得到对应的int值
|
||||
[FieldOffset(0)]
|
||||
public uint i;
|
||||
//得到对应的float值
|
||||
[FieldOffset(0)]
|
||||
public float f;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
//对8字节空间的联合体的C#实现
|
||||
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
||||
public struct Union8
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public byte b0;
|
||||
[FieldOffset(1)]
|
||||
public byte b1;
|
||||
[FieldOffset(2)]
|
||||
public byte b2;
|
||||
[FieldOffset(3)]
|
||||
public byte b3;
|
||||
//得到对应的int值
|
||||
[FieldOffset(0)]
|
||||
public int i1;
|
||||
[FieldOffset(4)]
|
||||
public int i2;
|
||||
//得到对应的float值
|
||||
[FieldOffset(0)]
|
||||
public double f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
internal class CollisionPartical
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Entities
|
||||
{
|
||||
public class Enemy : Entity
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Entity:INode<Entity>
|
||||
{
|
||||
internal vec2d _pos;
|
||||
internal IGeometry _collisionBox;
|
||||
internal Sensor<IGeometry> _collisionSensor;
|
||||
internal ContainerNode<Entity> _id;
|
||||
|
||||
|
||||
public IGeometry CollisionBox
|
||||
{
|
||||
get { return _collisionBox; }
|
||||
set { _collisionBox = value; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A sensor used for cheking out if a bullet hit a player or something else
|
||||
/// </summary>
|
||||
public Sensor<IGeometry> CollisionSensor
|
||||
{
|
||||
get { return _collisionSensor; }
|
||||
set { _collisionSensor = value; }
|
||||
}
|
||||
|
||||
public string Texture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
|
||||
/// </summary>
|
||||
public vec2d Location { get; }
|
||||
|
||||
/// <summary>
|
||||
/// X position of an enenmy entity
|
||||
/// </summary>
|
||||
public float X { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Y position of an enemy entity
|
||||
/// </summary>
|
||||
public float Y { get; set; }
|
||||
|
||||
ContainerNode<Entity> INode<Entity>.ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
public void SetLocation(Point p)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void INode<Entity>.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
_id = id as ContainerNode<Entity>;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Cannot set id twice!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public interface IEntity:INode
|
||||
{
|
||||
public IGeometry CollisionBox { get; set; }
|
||||
|
||||
public Sensor CollisionSensor { get; set; }
|
||||
|
||||
public string Texture { get; set; }
|
||||
|
||||
public Vec2D Location { get; }
|
||||
|
||||
public void SetLocation(Point p);
|
||||
}
|
||||
}
|
||||
@@ -5,43 +5,8 @@ using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Partical : IEntity
|
||||
public class Partical : Entity
|
||||
{
|
||||
internal IGeometry _collisionBox;
|
||||
internal Sensor _collisionSensor;
|
||||
internal string _texture;
|
||||
internal Vec2D _position;
|
||||
|
||||
IGeometry IEntity.CollisionBox
|
||||
{
|
||||
get { return _collisionBox; }
|
||||
set { _collisionBox = value; }
|
||||
}
|
||||
Sensor IEntity.CollisionSensor
|
||||
{
|
||||
get { return _collisionSensor; }
|
||||
set { _collisionSensor = value; }
|
||||
}
|
||||
string IEntity.Texture
|
||||
{
|
||||
get { return _texture; }
|
||||
set { _texture = value; }
|
||||
}
|
||||
Vec2D IEntity.Location
|
||||
{
|
||||
get { return _position; }
|
||||
}
|
||||
|
||||
ContainerNode<INode> INode.ID => throw new NotImplementedException();
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IEntity.SetLocation(StgSharp.Point p)
|
||||
{
|
||||
this._position = p._position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,58 +5,8 @@ using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Player : IEntity
|
||||
public class Player : Entity
|
||||
{
|
||||
internal IGeometry _collisionBox;
|
||||
internal Sensor _collisionSensor;
|
||||
internal string _texture;
|
||||
internal Vec2D _position;
|
||||
private ContainerNode<INode> _id;
|
||||
|
||||
IGeometry IEntity.CollisionBox
|
||||
{
|
||||
get { return this._collisionBox; }
|
||||
set { this._collisionBox = value; }
|
||||
}
|
||||
Sensor IEntity.CollisionSensor
|
||||
{
|
||||
get { return this._collisionSensor; }
|
||||
set { this._collisionSensor = value; }
|
||||
}
|
||||
string IEntity.Texture
|
||||
{
|
||||
get { return this._texture; }
|
||||
set { this._texture = value; }
|
||||
}
|
||||
Vec2D IEntity.Location
|
||||
{
|
||||
get { return this._position; }
|
||||
}
|
||||
|
||||
ContainerNode<INode> INode.ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
public void SetLocation(Point p)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
_id = id as ContainerNode<INode>;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Cannot set id twice!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Point: INode
|
||||
public class Point: INode<Point>
|
||||
{
|
||||
internal StgSharp.ContainerNode<INode> _id;
|
||||
internal StgSharp.ContainerNode<Point> _id;
|
||||
|
||||
internal Vec2D _position;
|
||||
internal vec2d _position;
|
||||
|
||||
internal GetLocationHandler getXHandler;
|
||||
internal GetLocationHandler getYHandler;
|
||||
|
||||
ContainerNode<INode> INode.ID
|
||||
ContainerNode<Point> INode<Point>.ID
|
||||
{
|
||||
get { return this._id; }
|
||||
}
|
||||
@@ -34,11 +34,11 @@ namespace StgSharp
|
||||
get { return this._position.Y; }
|
||||
}
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
void INode<Point>.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
_id = id as ContainerNode<INode>;
|
||||
_id = id as ContainerNode<Point>;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -7,24 +7,24 @@ namespace StgSharp.Math
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
public static float Det(Matrix2x2 array)
|
||||
public static float Det(matrix2x2 array)
|
||||
{
|
||||
return Cross(array.row1,array.row2);
|
||||
}
|
||||
|
||||
public static unsafe float Det(Matrix3x3 array)
|
||||
public static unsafe float Det(matrix3x3 array)
|
||||
{
|
||||
float* p = &array.row1.X;
|
||||
|
||||
Matrix2x2 matrix1 = new Matrix2x2(
|
||||
matrix2x2 matrix1 = new matrix2x2(
|
||||
*(p + 4), *(p + 5),
|
||||
*(p + 7), *(p + 8)
|
||||
);
|
||||
Matrix2x2 matrix2 = new Matrix2x2(
|
||||
matrix2x2 matrix2 = new matrix2x2(
|
||||
*(p + 3), *(p + 5),
|
||||
*(p + 6), *(p + 8)
|
||||
);
|
||||
Matrix2x2 matrix3 = new Matrix2x2(
|
||||
matrix2x2 matrix3 = new matrix2x2(
|
||||
*(p + 3), *(p + 4),
|
||||
*(p + 6), *(p + 7)
|
||||
);
|
||||
@@ -6,7 +6,7 @@ namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
public static float GetAngle(Vec2D vec1, Vec2D vec2)
|
||||
public static float GetAngle(vec2d vec1, vec2d vec2)
|
||||
{
|
||||
return Calc.ACos(
|
||||
vec1 .multiple(vec2)
|
||||
@@ -14,7 +14,7 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static float GetAngle(Vec3D vec1, Vec3D vec2)
|
||||
public static float GetAngle(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
return Calc.ACos(
|
||||
vec1 * vec2
|
||||
@@ -6,7 +6,7 @@ namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
public static float GetLength(this Vec3D vec)
|
||||
public static float GetLength(this vec3d vec)
|
||||
{
|
||||
return Calc.Sqrt(
|
||||
vec.X * vec.X +
|
||||
@@ -15,7 +15,7 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static float GetLength(this Vec2D vec)
|
||||
public static float GetLength(this vec2d vec)
|
||||
{
|
||||
return Calc.Sqrt(
|
||||
vec.X * vec.X +
|
||||
@@ -7,7 +7,7 @@ namespace StgSharp.Math
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
/*
|
||||
public static Vec2D GetVector(Vec4D pointPair)
|
||||
public static vec2d GetVector( vec4d pointPair)
|
||||
{
|
||||
return pointPair.Point2-pointPair.Point1;
|
||||
}
|
||||
@@ -13,9 +13,9 @@ namespace StgSharp.Math
|
||||
/// <param name="colum"></param>
|
||||
/// <param name="vec"></param>
|
||||
/// <returns></returns>
|
||||
public static Matrix2x2 multiple(this Colum2D colum, Vec2D vec)
|
||||
public static matrix2x2 multiple(this colum2 colum, vec2d vec)
|
||||
{
|
||||
return new Matrix2x2(
|
||||
return new matrix2x2(
|
||||
colum.X * vec.X, colum.X * vec.Y,
|
||||
colum.Y * vec.X, colum.Y * vec.Y
|
||||
);
|
||||
@@ -27,7 +27,7 @@ namespace StgSharp.Math
|
||||
/// <param name="vec1"></param>
|
||||
/// <param name="vec2"></param>
|
||||
/// <returns></returns>
|
||||
public static float multiple(this Vec2D vec1, Vec2D vec2)
|
||||
public static float multiple(this vec2d vec1, vec2d vec2)
|
||||
{
|
||||
return vec1.X * vec2.X + vec1.Y * vec2.Y;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace StgSharp.Math
|
||||
/// <param name="vec"></param>
|
||||
/// <param name="colum"></param>
|
||||
/// <returns></returns>
|
||||
public static float multiple(this Vec2D vec, Colum2D colum)
|
||||
public static float multiple(this vec2d vec, colum2 colum)
|
||||
{
|
||||
return vec.X * colum.X + vec.Y * colum.Y;
|
||||
}
|
||||
@@ -49,15 +49,15 @@ namespace StgSharp.Math
|
||||
/// <param name="vec"></param>
|
||||
/// <param name="matrix"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Vec2D multiple(this Vec2D vec, Matrix2x2 matrix)
|
||||
public static unsafe vec2d multiple(this vec2d vec, matrix2x2 matrix)
|
||||
{
|
||||
return new Vec2D(
|
||||
return new vec2d(
|
||||
vec.X * matrix.row1.X + vec.Y * matrix.row2.X,
|
||||
vec.X * matrix.row1.Y + vec.Y * matrix.row2.Y
|
||||
);
|
||||
}
|
||||
|
||||
public static float multiple(this Vec3D vec, Colum3D colum)
|
||||
public static float multiple(this vec3d vec, colum3 colum)
|
||||
{
|
||||
return vec.X * colum.X + vec.Y * colum.Y + vec.Z * colum.Z;
|
||||
}
|
||||
@@ -68,11 +68,11 @@ namespace StgSharp.Math
|
||||
/// <param name="vec"></param>
|
||||
/// <param name="matrix"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Vec3D multiple(this Vec2D vec, Matrix2x3 matrix)
|
||||
public static unsafe vec3d multiple(this vec2d vec, matrix2x3 matrix)
|
||||
{
|
||||
float* p = &matrix.row1.X;
|
||||
|
||||
return new Vec3D(
|
||||
return new vec3d(
|
||||
vec.X * *(p + 0) + vec.Y * *(p + 3),
|
||||
vec.X * *(p + 1) + vec.Y * *(p + 4),
|
||||
vec.X * *(p + 2) + vec.Y * *(p + 5)
|
||||
@@ -85,11 +85,11 @@ namespace StgSharp.Math
|
||||
/// <param name="vec"></param>
|
||||
/// <param name="matrix"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Vec4D multiple(this Vec2D vec, Matrix2x4 matrix)
|
||||
public static unsafe vec4d multiple(this vec2d vec, matrix2x4 matrix)
|
||||
{
|
||||
float* p = &matrix.row1.X;
|
||||
|
||||
return new Vec4D(
|
||||
return new vec4d(
|
||||
vec.X * *(p + 0) + vec.Y * *(p + 4),
|
||||
vec.X * *(p + 1) + vec.Y * *(p + 5),
|
||||
vec.X * *(p + 2) + vec.Y * *(p + 6),
|
||||
@@ -97,7 +97,7 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe float multiple(this Vec4D vec, Colum4D colum)
|
||||
public static unsafe float multiple(this vec4d vec, colum4 colum)
|
||||
{
|
||||
return vec.X * colum.X + vec.Y * colum.Y + vec.Z * colum.W + vec.W * colum.W;
|
||||
}
|
||||
@@ -108,12 +108,12 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix"></param>
|
||||
/// <param name="colum"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Colum2D multiple(this Matrix2x2 matrix, Colum2D colum)
|
||||
public static unsafe colum2 multiple(this matrix2x2 matrix, colum2 colum)
|
||||
{
|
||||
float* p1 = &matrix.row1.X;
|
||||
float* p2 = &colum.X;
|
||||
|
||||
return new Colum2D(
|
||||
return new colum2(
|
||||
*(p1 + 0) * *(p2 + 0) + *(p1 + 1) * *(p2 + 1),
|
||||
*(p1 + 2) * *(p2 + 0) + *(p1 + 3) * *(p2 + 1)
|
||||
);
|
||||
@@ -125,7 +125,7 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x2 multiple(this Matrix2x2 matrix1, Matrix2x2 matrix2)
|
||||
public static unsafe matrix2x2 multiple(this matrix2x2 matrix1, matrix2x2 matrix2)
|
||||
{
|
||||
float* a11 = &matrix1.row1.X;
|
||||
float* a12 = &matrix1.row1.Y;
|
||||
@@ -163,7 +163,7 @@ namespace StgSharp.Math
|
||||
var u6 = u3 - m4;
|
||||
var u7 = u3 + m5;
|
||||
|
||||
return new Matrix2x2(u1, u5, u6, u7);
|
||||
return new matrix2x2(u1, u5, u6, u7);
|
||||
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x3 multiple(this Matrix2x2 matrix1, Matrix2x3 matrix2)
|
||||
public static unsafe matrix2x3 multiple(this matrix2x2 matrix1, matrix2x3 matrix2)
|
||||
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
@@ -184,10 +184,10 @@ namespace StgSharp.Math
|
||||
float a21 = *(p1 + 2);
|
||||
float a22 = *(p1 + 3);
|
||||
|
||||
Vec2D b11 = new Vec2D(*(p2 + 0), *(p2 + 1));
|
||||
Vec2D b12 = new Vec2D(*(p2 + 2), 0);
|
||||
Vec2D b21 = new Vec2D(*(p2 + 3), *(p2 + 4));
|
||||
Vec2D b22 = new Vec2D(*(p2 + 5), 0);
|
||||
vec2d b11 = new vec2d(*(p2 + 0), *(p2 + 1));
|
||||
vec2d b12 = new vec2d(*(p2 + 2), 0);
|
||||
vec2d b21 = new vec2d(*(p2 + 3), *(p2 + 4));
|
||||
vec2d b22 = new vec2d(*(p2 + 5), 0);
|
||||
|
||||
var s1 = a21 + a22;
|
||||
var s2 = s1 - a11;
|
||||
@@ -215,7 +215,7 @@ namespace StgSharp.Math
|
||||
var u6 = u3 - m4;
|
||||
var u7 = u3 + m5;
|
||||
|
||||
return new Matrix2x3(
|
||||
return new matrix2x3(
|
||||
u1.X, u1.Y, u5.X,
|
||||
u6.X, u6.Y, u7.X
|
||||
);
|
||||
@@ -228,7 +228,7 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x4 multiple(this Matrix2x2 matrix1, Matrix2x4 matrix2)
|
||||
public static unsafe matrix2x4 multiple(this matrix2x2 matrix1, matrix2x4 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
@@ -238,10 +238,10 @@ namespace StgSharp.Math
|
||||
float a21 = *(p1 + 2);
|
||||
float a22 = *(p1 + 3);
|
||||
|
||||
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));
|
||||
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;
|
||||
@@ -269,7 +269,7 @@ namespace StgSharp.Math
|
||||
var u6 = u3 - m4;
|
||||
var u7 = u3 + m5;
|
||||
|
||||
return new Matrix2x4(
|
||||
return new matrix2x4(
|
||||
u1.X, u1.Y, u5.X, u5.Y,
|
||||
u6.X, u6.Y, u7.X, u7.Y
|
||||
);
|
||||
@@ -281,9 +281,9 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix"></param>
|
||||
/// <param name="vec"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Colum2D multiple(this Matrix2x3 matrix, Colum3D vec)
|
||||
public static unsafe colum2 multiple(this matrix2x3 matrix, colum3 vec)
|
||||
{
|
||||
return new Colum2D(
|
||||
return new colum2(
|
||||
matrix.row1.X * vec.X + matrix.row1.Y * vec.Y + matrix.row1.Z * vec.Z,
|
||||
matrix.row2.X * vec.X + matrix.row2.Y * vec.Y + matrix.row2.Z * vec.Z
|
||||
);
|
||||
@@ -295,16 +295,16 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x2 multiple(this Matrix2x3 matrix1, Matrix3x2 matrix2)
|
||||
public static unsafe matrix2x2 multiple(this matrix2x3 matrix1, matrix3x2 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
Matrix2x2 a1 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
Colum2D a2 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
matrix2x2 a1 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
colum2 a2 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
|
||||
Matrix2x2 b1 = new Matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 2), *(p2 + 3));
|
||||
Vec2D b2 = new Vec2D(*(p2 + 4), *(p2 + 5));
|
||||
matrix2x2 b1 = new matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 2), *(p2 + 3));
|
||||
vec2d b2 = new vec2d(*(p2 + 4), *(p2 + 5));
|
||||
|
||||
return a1.multiple(b1) + a2.multiple(b2);
|
||||
}
|
||||
@@ -315,23 +315,23 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x3 multiple(this Matrix2x3 matrix1, Matrix3x3 matrix2)
|
||||
public static unsafe matrix2x3 multiple(this matrix2x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
var a1 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a2 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
var a1 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a2 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
|
||||
var b11 = new Matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4));
|
||||
var b12 = new Colum2D(*(p2 + 2), *(p2 + 5));
|
||||
var b21 = new Vec2D(*(p2 + 6), *(p2 + 7));
|
||||
var b11 = new matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4));
|
||||
var b12 = new colum2(*(p2 + 2), *(p2 + 5));
|
||||
var b21 = new vec2d(*(p2 + 6), *(p2 + 7));
|
||||
var b22 = *(p2 + 8);
|
||||
|
||||
var c1 = a1.multiple(b11) + a2.multiple(b21);
|
||||
var c2 = a1.multiple(b12) + a2 * b22;
|
||||
|
||||
return new Matrix2x3(
|
||||
return new matrix2x3(
|
||||
c1.row1.X, c1.row1.Y, c2.X,
|
||||
c1.row2.X, c1.row2.Y, c2.Y
|
||||
);
|
||||
@@ -343,31 +343,31 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x4 multiple(this Matrix2x3 matrix1, Matrix3x4 matrix2)
|
||||
public static unsafe matrix2x4 multiple(this matrix2x3 matrix1, matrix3x4 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
var a1 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a2 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
var a1 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a2 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
|
||||
var b11 = new Matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 4), *(p2 + 5));
|
||||
var b12 = new Matrix2x2(*(p2 + 2), *(p2 + 3), *(p2 + 6), *(p2 + 7));
|
||||
var b21 = new Vec2D(*(p2 + 8), *(p2 + 9));
|
||||
var b22 = new Vec2D(*(p2 + 10), *(p2 + 11));
|
||||
var b11 = new matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 4), *(p2 + 5));
|
||||
var b12 = new matrix2x2(*(p2 + 2), *(p2 + 3), *(p2 + 6), *(p2 + 7));
|
||||
var b21 = new vec2d(*(p2 + 8), *(p2 + 9));
|
||||
var b22 = new vec2d(*(p2 + 10), *(p2 + 11));
|
||||
|
||||
var c1 = a1.multiple(b11) + a2.multiple(b21);
|
||||
var c2 = a1.multiple(b12) + a2.multiple(b22);
|
||||
|
||||
return new Matrix2x4(
|
||||
new Vec4D(c1.row1,c2.row1),
|
||||
new Vec4D(c1.row2,c2.row2)
|
||||
return new matrix2x4(
|
||||
new vec4d(c1.row1,c2.row1),
|
||||
new vec4d(c1.row2,c2.row2)
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Colum2D multiple(this Matrix2x4 matrix, Colum4D colum)
|
||||
public static unsafe colum2 multiple(this matrix2x4 matrix, colum4 colum)
|
||||
{
|
||||
return new Colum2D(
|
||||
return new colum2(
|
||||
matrix.row1.multiple(colum),
|
||||
matrix.row2.multiple(colum)
|
||||
);
|
||||
@@ -379,20 +379,20 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x2 multiple(this Matrix2x4 matrix1, Matrix4x2 matrix2)
|
||||
public static unsafe matrix2x2 multiple(this matrix2x4 matrix1, matrix4x2 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
Vec2D a11 = new Vec2D(*(p1 + 0), *(p1 + 1));
|
||||
Vec2D a12 = new Vec2D(*(p1 + 2), *(p1 + 3));
|
||||
Vec2D a21 = new Vec2D(*(p1 + 4), *(p1 + 5));
|
||||
Vec2D a22 = new Vec2D(*(p1 + 6), *(p1 + 7));
|
||||
vec2d a11 = new vec2d(*(p1 + 0), *(p1 + 1));
|
||||
vec2d a12 = new vec2d(*(p1 + 2), *(p1 + 3));
|
||||
vec2d a21 = new vec2d(*(p1 + 4), *(p1 + 5));
|
||||
vec2d a22 = new vec2d(*(p1 + 6), *(p1 + 7));
|
||||
|
||||
Colum2D b11 = new Colum2D(*(p2 + 0), *(p2 + 2));
|
||||
Colum2D b12 = new Colum2D(*(p2 + 1), *(p2 + 3));
|
||||
Colum2D b21 = new Colum2D(*(p2 + 4), *(p2 + 6));
|
||||
Colum2D b22 = new Colum2D(*(p2 + 5), *(p2 + 7));
|
||||
colum2 b11 = new colum2(*(p2 + 0), *(p2 + 2));
|
||||
colum2 b12 = new colum2(*(p2 + 1), *(p2 + 3));
|
||||
colum2 b21 = new colum2(*(p2 + 4), *(p2 + 6));
|
||||
colum2 b22 = new colum2(*(p2 + 5), *(p2 + 7));
|
||||
|
||||
var s1 = a21 + a22;
|
||||
var s2 = s1 - a11;
|
||||
@@ -420,7 +420,7 @@ namespace StgSharp.Math
|
||||
var u6 = u3 - m4;
|
||||
var u7 = u3 + m5;
|
||||
|
||||
return new Matrix2x2(u1, u5, u6, u7);
|
||||
return new matrix2x2(u1, u5, u6, u7);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -429,12 +429,12 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x3 multiple(this Matrix2x4 matrix1, Matrix4x3 matrix2)
|
||||
public static unsafe matrix2x3 multiple(this matrix2x4 matrix1, matrix4x3 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
return new Matrix2x3(
|
||||
return new matrix2x3(
|
||||
getMatrixMember(p1,p2), getMatrixMember(p1, p2+1), getMatrixMember(p1, p2+2),
|
||||
getMatrixMember(p1+4, p2), getMatrixMember(p1+4, p2+1), getMatrixMember(p1+4, p2 + 2)
|
||||
);
|
||||
@@ -459,29 +459,29 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix2x4 multiple(this Matrix2x4 matrix1, Matrix4x4 matrix2)
|
||||
public static unsafe matrix2x4 multiple(this matrix2x4 matrix1, matrix4x4 matrix2)
|
||||
{
|
||||
|
||||
Matrix2x2 a1 = new Matrix2x2(matrix1.row1.Point1,matrix1.row2.Point1);
|
||||
Matrix2x2 a2 = new Matrix2x2(matrix1.row1.Point2, matrix1.row2.Point2);
|
||||
matrix2x2 a1 = new matrix2x2(matrix1.row1.Point1,matrix1.row2.Point1);
|
||||
matrix2x2 a2 = new matrix2x2(matrix1.row1.Point2, matrix1.row2.Point2);
|
||||
|
||||
Matrix2x2 b11 = new Matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
|
||||
Matrix2x2 b12 = new Matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
|
||||
Matrix2x2 b21 = new Matrix2x2(matrix2.row3.Point1, matrix2.row4.Point1);
|
||||
Matrix2x2 b22 = new Matrix2x2(matrix2.row3.Point2, matrix2.row4.Point2);
|
||||
matrix2x2 b11 = new matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
|
||||
matrix2x2 b12 = new matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
|
||||
matrix2x2 b21 = new matrix2x2(matrix2.row3.Point1, matrix2.row4.Point1);
|
||||
matrix2x2 b22 = new matrix2x2(matrix2.row3.Point2, matrix2.row4.Point2);
|
||||
|
||||
var c1 = a1.multiple(b11) + a2.multiple(b21);
|
||||
var c2 = a1.multiple(b12) + a2.multiple(b22);
|
||||
|
||||
return new Matrix2x4(
|
||||
new Vec4D(c1.row1, c2.row1),
|
||||
new Vec4D(c1.row2, c2.row2));
|
||||
return new matrix2x4(
|
||||
new vec4d(c1.row1, c2.row1),
|
||||
new vec4d(c1.row2, c2.row2));
|
||||
}
|
||||
|
||||
|
||||
public static unsafe Colum3D multiple(this Matrix3x2 matrix, Colum2D colum)
|
||||
public static unsafe colum3 multiple(this matrix3x2 matrix, colum2 colum)
|
||||
{
|
||||
return new Colum3D(
|
||||
return new colum3(
|
||||
matrix.row1.multiple(colum),
|
||||
matrix.row1.multiple(colum),
|
||||
matrix.row1.multiple(colum)
|
||||
@@ -494,14 +494,14 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix3x2 multiple(this Matrix3x2 matrix1, Matrix2x2 matrix2)
|
||||
public static unsafe matrix3x2 multiple(this matrix3x2 matrix1, matrix2x2 matrix2)
|
||||
{
|
||||
var a1 = new Matrix2x2(matrix1.row1, matrix1.row2);
|
||||
var a1 = new matrix2x2(matrix1.row1, matrix1.row2);
|
||||
var a2 = matrix1.row3;
|
||||
|
||||
var c1 = a1.multiple(matrix2);
|
||||
|
||||
return new Matrix3x2(
|
||||
return new matrix3x2(
|
||||
c1.row1, c1.row2, a2.multiple(matrix2)
|
||||
);
|
||||
}
|
||||
@@ -512,16 +512,16 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix3x3 multiple(this Matrix3x2 matrix1, Matrix2x3 matrix2)
|
||||
public static unsafe matrix3x3 multiple(this matrix3x2 matrix1, matrix2x3 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
Matrix2x2 a1 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 2), *(p1 + 3));
|
||||
Vec2D a2 = new Vec2D(*(p1 + 4), *(p1 + 5));
|
||||
matrix2x2 a1 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 2), *(p1 + 3));
|
||||
vec2d a2 = new vec2d(*(p1 + 4), *(p1 + 5));
|
||||
|
||||
Matrix2x2 b1 = new Matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4));
|
||||
Colum2D b2 = new Colum2D(*(p2 + 2), *(p2 + 5));
|
||||
matrix2x2 b1 = new matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4));
|
||||
colum2 b2 = new colum2(*(p2 + 2), *(p2 + 5));
|
||||
|
||||
var m11 = a1.multiple(b1);
|
||||
var m12 = a1.multiple(b2);
|
||||
@@ -530,7 +530,7 @@ namespace StgSharp.Math
|
||||
|
||||
float* p3 = &m11.row1.X;
|
||||
|
||||
return new Matrix3x3(
|
||||
return new matrix3x3(
|
||||
*(p3 + 0), *(p3 + 1),m12.X,
|
||||
*(p3 + 2), *(p3 + 3),m12.Y,
|
||||
m21.X, m21.Y, m22
|
||||
@@ -543,29 +543,29 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix3x4 multiple(this Matrix3x2 matrix1, Matrix2x4 matrix2)
|
||||
public static unsafe matrix3x4 multiple(this matrix3x2 matrix1, matrix2x4 matrix2)
|
||||
{
|
||||
var a1 = new Matrix2x2(matrix1.row1,matrix1.row2);
|
||||
var a1 = new matrix2x2(matrix1.row1,matrix1.row2);
|
||||
var a2 = matrix1.row3;
|
||||
|
||||
var b1 = new Matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
|
||||
var b2 = new Matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
|
||||
var b1 = new matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
|
||||
var b2 = new matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
|
||||
|
||||
var c11 = a1.multiple(b1);
|
||||
var c12 = a1.multiple(b2);
|
||||
var c21 = a2.multiple(b1);
|
||||
var c22 = a2.multiple(b2);
|
||||
|
||||
return new Matrix3x4(
|
||||
new Vec4D(c11.row1, c12.row1),
|
||||
new Vec4D(c11.row2, c12.row2),
|
||||
new Vec4D(c21, c22)
|
||||
return new matrix3x4(
|
||||
new vec4d(c11.row1, c12.row1),
|
||||
new vec4d(c11.row2, c12.row2),
|
||||
new vec4d(c21, c22)
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Colum3D multiple(this Matrix3x3 matrix, Colum3D colum)
|
||||
public static unsafe colum3 multiple(this matrix3x3 matrix, colum3 colum)
|
||||
{
|
||||
return new Colum3D(
|
||||
return new colum3(
|
||||
matrix.row1.multiple(colum),
|
||||
matrix.row2.multiple(colum),
|
||||
matrix.row3.multiple(colum)
|
||||
@@ -578,22 +578,22 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix3x2 multiple(this Matrix3x3 matrix1, Matrix3x2 matrix2)
|
||||
public static unsafe matrix3x2 multiple(this matrix3x3 matrix1, matrix3x2 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
|
||||
var a11 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new Vec2D(*(p1 + 6), *(p1 + 7));
|
||||
var a11 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new vec2d(*(p1 + 6), *(p1 + 7));
|
||||
var a22 = *(p1 + 8);
|
||||
|
||||
var b1 = new Matrix2x2(matrix2.row1,matrix2.row2);
|
||||
var b1 = new matrix2x2(matrix2.row1,matrix2.row2);
|
||||
var b2 = matrix2.row3;
|
||||
|
||||
var c1 = a11.multiple(b1) + a12.multiple(b2);
|
||||
var c2 = a21.multiple(b1) + b2 * a22;
|
||||
|
||||
return new Matrix3x2(c1.row1,c1.row2,c2);
|
||||
return new matrix3x2(c1.row1,c1.row2,c2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -602,19 +602,19 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix3x3 multiple(this Matrix3x3 matrix1, Matrix3x3 matrix2)
|
||||
public static unsafe matrix3x3 multiple(this matrix3x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
Matrix2x2 a11 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
Colum2D a12 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
Vec2D a21 = new Vec2D(*(p1 + 6), *(p1 + 7));
|
||||
matrix2x2 a11 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
colum2 a12 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
vec2d a21 = new vec2d(*(p1 + 6), *(p1 + 7));
|
||||
float a22 = *(p1 + 8);
|
||||
|
||||
Matrix2x2 b11 = new Matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4));
|
||||
Colum2D b12 = new Colum2D(*(p2 + 2), *(p2 + 5));
|
||||
Vec2D b21 = new Vec2D(*(p2 + 6), *(p2 + 7));
|
||||
matrix2x2 b11 = new matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4));
|
||||
colum2 b12 = new colum2(*(p2 + 2), *(p2 + 5));
|
||||
vec2d b21 = new vec2d(*(p2 + 6), *(p2 + 7));
|
||||
float b22 = *(p2 + 8);
|
||||
|
||||
var c11 = a11.multiple(b11) + a12.multiple(b21);
|
||||
@@ -624,25 +624,25 @@ namespace StgSharp.Math
|
||||
|
||||
float* p = &(c11.row1.X);
|
||||
|
||||
return new Matrix3x3(
|
||||
return new matrix3x3(
|
||||
*(p + 0), *(p + 1), c12.X,
|
||||
*(p + 2), *(p + 3), c12.Y,
|
||||
c21.X, c21.Y, c22
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Matrix3x4 multiple(this Matrix3x3 matrix1, Matrix3x4 matrix2)
|
||||
public static unsafe matrix3x4 multiple(this matrix3x3 matrix1, matrix3x4 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
var a11 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new Vec2D(*(p1 + 6), *(p1 + 7));
|
||||
var a11 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new vec2d(*(p1 + 6), *(p1 + 7));
|
||||
var a22 = *(p1 + 8);
|
||||
|
||||
var b11 = new Matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
|
||||
var b12 = new Matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
|
||||
var b11 = new matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
|
||||
var b12 = new matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
|
||||
var b21 = matrix2.row3.Point1;
|
||||
var b22 = matrix2.row3.Point2;
|
||||
|
||||
@@ -652,17 +652,17 @@ namespace StgSharp.Math
|
||||
var c22 = a21.multiple(b12) + b22 * a22;
|
||||
|
||||
|
||||
return new Matrix3x4(
|
||||
new Vec4D(c11.row1,c12.row1),
|
||||
new Vec4D(c11.row2,c12.row2),
|
||||
new Vec4D(c21,c22)
|
||||
return new matrix3x4(
|
||||
new vec4d(c11.row1,c12.row1),
|
||||
new vec4d(c11.row2,c12.row2),
|
||||
new vec4d(c21,c22)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static unsafe Colum3D multiple(this Matrix3x4 matrix, Colum4D colum)
|
||||
public static unsafe colum3 multiple(this matrix3x4 matrix, colum4 colum)
|
||||
{
|
||||
return new Colum3D(
|
||||
return new colum3(
|
||||
matrix.row1.multiple(colum),
|
||||
matrix.row2.multiple(colum),
|
||||
matrix.row3.multiple(colum)
|
||||
@@ -675,23 +675,23 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix3x2 multiple(this Matrix3x4 matrix1, Matrix4x2 matrix2)
|
||||
public static unsafe matrix3x2 multiple(this matrix3x4 matrix1, matrix4x2 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
Matrix2x2 a11 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 4), *(p1 + 5));
|
||||
Matrix2x2 a12 = new Matrix2x2(*(p1 + 2), *(p1 + 3), *(p1 + 6), *(p1 + 7));
|
||||
Vec2D a21 = new Vec2D(*(p1 + 8), *(p1 + 9));
|
||||
Vec2D a22 = new Vec2D(*(p1 + 10), *(p1 + 11));
|
||||
matrix2x2 a11 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 4), *(p1 + 5));
|
||||
matrix2x2 a12 = new matrix2x2(*(p1 + 2), *(p1 + 3), *(p1 + 6), *(p1 + 7));
|
||||
vec2d a21 = new vec2d(*(p1 + 8), *(p1 + 9));
|
||||
vec2d a22 = new vec2d(*(p1 + 10), *(p1 + 11));
|
||||
|
||||
Matrix2x2 b1 = new Matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 2), *(p2 + 3));
|
||||
Matrix2x2 b2 = new Matrix2x2(*(p2 + 4), *(p2 + 5), *(p2 + 6), *(p2 + 7));
|
||||
matrix2x2 b1 = new matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 2), *(p2 + 3));
|
||||
matrix2x2 b2 = new matrix2x2(*(p2 + 4), *(p2 + 5), *(p2 + 6), *(p2 + 7));
|
||||
|
||||
var c1 = a11.multiple(b1) + a12.multiple(b2);
|
||||
var c2 = a21.multiple(b1) + a22.multiple(b2);
|
||||
|
||||
return new Matrix3x2(c1.row1,c1.row2,c2);
|
||||
return new matrix3x2(c1.row1,c1.row2,c2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -700,28 +700,28 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix3x3 multiple(this Matrix3x4 matrix1, Matrix4x3 matrix2)
|
||||
public static unsafe matrix3x3 multiple(this matrix3x4 matrix1, matrix4x3 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
Matrix2x2 a11 = new Matrix2x2(
|
||||
matrix2x2 a11 = new matrix2x2(
|
||||
*(p1 + 0), *(p1 + 1), *(p1 + 4), *(p1 + 5)
|
||||
);
|
||||
Matrix2x2 a12 = new Matrix2x2(
|
||||
matrix2x2 a12 = new matrix2x2(
|
||||
*(p1 + 2), *(p1 + 3), *(p1 + 6), *(p1 + 7)
|
||||
);
|
||||
Vec2D a21 = new Vec2D(*(p1 + 8), *(p1 + 9));
|
||||
Vec2D a22 = new Vec2D(*(p1 + 10), *(p1 + 11));
|
||||
vec2d a21 = new vec2d(*(p1 + 8), *(p1 + 9));
|
||||
vec2d a22 = new vec2d(*(p1 + 10), *(p1 + 11));
|
||||
|
||||
Matrix2x2 b11 = new Matrix2x2(
|
||||
matrix2x2 b11 = new matrix2x2(
|
||||
*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4)
|
||||
);
|
||||
Colum2D b12 = new Colum2D(*(p2 + 2), *(p2 + 5));
|
||||
Matrix2x2 b21 = new Matrix2x2(
|
||||
colum2 b12 = new colum2(*(p2 + 2), *(p2 + 5));
|
||||
matrix2x2 b21 = new matrix2x2(
|
||||
*(p2 + 6), *(p2 + 7), *(p2 + 9), *(p2 + 10)
|
||||
);
|
||||
Colum2D b22 = new Colum2D(*(p2 + 8), *(p2 + 11));
|
||||
colum2 b22 = new colum2(*(p2 + 8), *(p2 + 11));
|
||||
|
||||
var c11 = a11.multiple(b11) + a12.multiple(b21);
|
||||
var c12 = a11.multiple(b12) + a12.multiple(b22);
|
||||
@@ -730,7 +730,7 @@ namespace StgSharp.Math
|
||||
|
||||
float* pc1 = &c11.row1.X;
|
||||
|
||||
return new Matrix3x3(
|
||||
return new matrix3x3(
|
||||
*(pc1 + 0), *(pc1 + 1), c12.X,
|
||||
*(pc1 + 2), *(pc1 + 3), c12.Y,
|
||||
c21.X, c21.Y, c22
|
||||
@@ -743,41 +743,41 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix3x4 multiple(this Matrix3x4 matrix1, Matrix4x4 matrix2)
|
||||
public static unsafe matrix3x4 multiple(this matrix3x4 matrix1, matrix4x4 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
var a11 = new Matrix2x2(matrix1.row1.Point1,matrix1.row2.Point1);
|
||||
var a12 = new Matrix2x2(matrix1.row1.Point2,matrix1.row2.Point2);
|
||||
var a11 = new matrix2x2(matrix1.row1.Point1,matrix1.row2.Point1);
|
||||
var a12 = new matrix2x2(matrix1.row1.Point2,matrix1.row2.Point2);
|
||||
var a21 = matrix1.row3.Point1;
|
||||
var a22 = matrix1.row3.Point2;
|
||||
|
||||
var b11 = new Matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
|
||||
var b12 = new Matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
|
||||
var b21 = new Matrix2x2(matrix2.row3.Point1, matrix2.row4.Point1);
|
||||
var b22 = new Matrix2x2(matrix2.row3.Point2, matrix2.row4.Point2);
|
||||
var b11 = new matrix2x2(matrix2.row1.Point1, matrix2.row2.Point1);
|
||||
var b12 = new matrix2x2(matrix2.row1.Point2, matrix2.row2.Point2);
|
||||
var b21 = new matrix2x2(matrix2.row3.Point1, matrix2.row4.Point1);
|
||||
var b22 = new matrix2x2(matrix2.row3.Point2, matrix2.row4.Point2);
|
||||
|
||||
var c1 = a11.multiple(b11) + a12.multiple(b21);
|
||||
var c2 = a11.multiple(b12) + a12.multiple(b22);
|
||||
var c3 = a21.multiple(b11) + a22.multiple(b21);
|
||||
var c4 = a21.multiple(b12) + a22.multiple(b22);
|
||||
|
||||
return new Matrix3x4(
|
||||
new Vec4D(c1.row1,c2.row1),
|
||||
new Vec4D(c1.row2,c2.row2),
|
||||
new Vec4D(c3,c4)
|
||||
return new matrix3x4(
|
||||
new vec4d(c1.row1,c2.row1),
|
||||
new vec4d(c1.row2,c2.row2),
|
||||
new vec4d(c3,c4)
|
||||
) ;
|
||||
}
|
||||
|
||||
|
||||
public static unsafe Matrix4x2 multiple(this Matrix4x2 matrix1, Matrix2x2 matrix2)
|
||||
public static unsafe matrix4x2 multiple(this matrix4x2 matrix1, matrix2x2 matrix2)
|
||||
{
|
||||
float* p = &matrix1.row1.X;
|
||||
var a11 = new Colum2D(*(p + 0), *(p + 2));
|
||||
var a12 = new Colum2D(*(p + 1), *(p + 3));
|
||||
var a21 = new Colum2D(*(p + 4), *(p + 6));
|
||||
var a22 = new Colum2D(*(p + 5), *(p + 7));
|
||||
var a11 = new colum2(*(p + 0), *(p + 2));
|
||||
var a12 = new colum2(*(p + 1), *(p + 3));
|
||||
var a21 = new colum2(*(p + 4), *(p + 6));
|
||||
var a22 = new colum2(*(p + 5), *(p + 7));
|
||||
|
||||
var b11 = matrix2.row1.X;
|
||||
var b12 = matrix2.row1.Y;
|
||||
@@ -810,23 +810,23 @@ namespace StgSharp.Math
|
||||
var u6 = u3 - m4;
|
||||
var u7 = u3 + m5;
|
||||
|
||||
return new Matrix4x2(
|
||||
new Vec2D(u1.X,u5.X),
|
||||
new Vec2D(u1.Y,u5.Y),
|
||||
new Vec2D(u6.X,u7.X),
|
||||
new Vec2D(u6.Y,u7.Y)
|
||||
return new matrix4x2(
|
||||
new vec2d(u1.X,u5.X),
|
||||
new vec2d(u1.Y,u5.Y),
|
||||
new vec2d(u6.X,u7.X),
|
||||
new vec2d(u6.Y,u7.Y)
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Matrix4x3 multiple(this Matrix4x2 matrix1, Matrix2x3 matrix2)
|
||||
public static unsafe matrix4x3 multiple(this matrix4x2 matrix1, matrix2x3 matrix2)
|
||||
{
|
||||
float* p = &matrix2.row1.X;
|
||||
|
||||
var a1 = new Matrix2x2(matrix1.row1, matrix1.row2);
|
||||
var a2 = new Matrix2x2(matrix1.row3, matrix1.row4);
|
||||
var a1 = new matrix2x2(matrix1.row1, matrix1.row2);
|
||||
var a2 = new matrix2x2(matrix1.row3, matrix1.row4);
|
||||
|
||||
var b1 = new Matrix2x2(*(p + 0), *(p + 1), *(p + 3), *(p + 4));
|
||||
var b2 = new Colum2D(*(p + 2), *(p + 5));
|
||||
var b1 = new matrix2x2(*(p + 0), *(p + 1), *(p + 3), *(p + 4));
|
||||
var b2 = new colum2(*(p + 2), *(p + 5));
|
||||
|
||||
var c11 = a1.multiple(b1);
|
||||
var c12 = a1.multiple(b2);
|
||||
@@ -836,7 +836,7 @@ namespace StgSharp.Math
|
||||
float* pc1 = &c11.row1.X;
|
||||
float* pc2 = &c21.row1.X;
|
||||
|
||||
return new Matrix4x3(
|
||||
return new matrix4x3(
|
||||
*(pc1 + 0), *(pc1 + 1),c12.X,
|
||||
*(pc1 + 2), *(pc1 + 3),c12.Y,
|
||||
*(pc2 + 0), *(pc2 + 1),c22.X,
|
||||
@@ -850,20 +850,20 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix4x4 multiple(this Matrix4x2 matrix1, Matrix2x4 matrix2)
|
||||
public static unsafe matrix4x4 multiple(this matrix4x2 matrix1, matrix2x4 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.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));
|
||||
colum2 a11 = new colum2(*(p1 + 0), *(p1 + 2));
|
||||
colum2 a12 = new colum2(*(p1 + 1), *(p1 + 3));
|
||||
colum2 a21 = new colum2(*(p1 + 4), *(p1 + 6));
|
||||
colum2 a22 = new colum2(*(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));
|
||||
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;
|
||||
@@ -891,47 +891,47 @@ namespace StgSharp.Math
|
||||
var u6 = u3 - m4;
|
||||
var u7 = u3 + m5;
|
||||
|
||||
return new Matrix4x4(
|
||||
new Vec4D(u1.row1.X, u1.row1.Y, u5.row1.X, u5.row1.Y),
|
||||
new Vec4D(u1.row2.X, u1.row2.Y, u5.row2.X, u5.row2.Y),
|
||||
new Vec4D(u6.row1.X, u6.row1.Y, u7.row1.X, u7.row1.Y),
|
||||
new Vec4D(u6.row2.X, u6.row2.Y, u7.row2.X, u7.row2.Y)
|
||||
return new matrix4x4(
|
||||
new vec4d(u1.row1.X, u1.row1.Y, u5.row1.X, u5.row1.Y),
|
||||
new vec4d(u1.row2.X, u1.row2.Y, u5.row2.X, u5.row2.Y),
|
||||
new vec4d(u6.row1.X, u6.row1.Y, u7.row1.X, u7.row1.Y),
|
||||
new vec4d(u6.row2.X, u6.row2.Y, u7.row2.X, u7.row2.Y)
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Matrix4x2 multiple(this Matrix4x3 matrix1, Matrix3x2 matrix2)
|
||||
public static unsafe matrix4x2 multiple(this matrix4x3 matrix1, matrix3x2 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
var a11 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new Matrix2x2(*(p1 + 6), *(p1 + 7), *(p1 + 9), *(p1 + 10));
|
||||
var a22 = new Colum2D(*(p1 + 8), *(p1 + 11));
|
||||
var a11 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new matrix2x2(*(p1 + 6), *(p1 + 7), *(p1 + 9), *(p1 + 10));
|
||||
var a22 = new colum2(*(p1 + 8), *(p1 + 11));
|
||||
|
||||
var b1 = new Matrix2x2(*(p2 + 0), *(p2 + 0), *(p2 + 0), *(p2 + 0));
|
||||
var b1 = new matrix2x2(*(p2 + 0), *(p2 + 0), *(p2 + 0), *(p2 + 0));
|
||||
var b2 = matrix2.row3;
|
||||
|
||||
var c1 = a11.multiple(b1) + a12.multiple(b2);
|
||||
var c2 = a21.multiple(b1) + a22.multiple(b2);
|
||||
|
||||
return new Matrix4x2(c1.row1,c1.row2,c2.row1,c2.row2);
|
||||
return new matrix4x2(c1.row1,c1.row2,c2.row1,c2.row2);
|
||||
|
||||
}
|
||||
|
||||
public static unsafe Matrix4x3 multiple(this Matrix4x3 matrix1, Matrix3x3 matrix2)
|
||||
public static unsafe matrix4x3 multiple(this matrix4x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
var a11 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new Matrix2x2(*(p1 + 6), *(p1 + 7), *(p1 + 9), *(p1 + 10));
|
||||
var a22 = new Colum2D(*(p1 + 8), *(p1 + 11));
|
||||
var a11 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new matrix2x2(*(p1 + 6), *(p1 + 7), *(p1 + 9), *(p1 + 10));
|
||||
var a22 = new colum2(*(p1 + 8), *(p1 + 11));
|
||||
|
||||
var b11 = new Matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4));
|
||||
var b12 = new Colum2D(*(p2 + 2), *(p2 + 5));
|
||||
var b21 = new Vec2D(*(p2 + 9), *(p2 + 10));
|
||||
var b11 = new matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 3), *(p2 + 4));
|
||||
var b12 = new colum2(*(p2 + 2), *(p2 + 5));
|
||||
var b21 = new vec2d(*(p2 + 9), *(p2 + 10));
|
||||
var b22 = matrix2.row3.Z;
|
||||
|
||||
var c11 = a11.multiple(b11) + a12.multiple(b21);
|
||||
@@ -942,7 +942,7 @@ namespace StgSharp.Math
|
||||
float* p3 = &c11.row1.X;
|
||||
float* p4 = &c21.row1.X;
|
||||
|
||||
return new Matrix4x3(
|
||||
return new matrix4x3(
|
||||
*(p3 + 0), *(p3 + 1),c12.X,
|
||||
*(p3 + 2), *(p3 + 3),c12.Y,
|
||||
*(p4 + 0), *(p4 + 1),c22.X,
|
||||
@@ -950,18 +950,18 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Matrix4x4 multiple(this Matrix4x3 matrix1, Matrix3x4 matrix2)
|
||||
public static unsafe matrix4x4 multiple(this matrix4x3 matrix1, matrix3x4 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
var a11 = new Matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new Colum2D(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new Matrix2x2(*(p1 + 6), *(p1 + 7), *(p1 + 9), *(p1 + 10));
|
||||
var a22 = new Colum2D(*(p1 + 8), *(p1 + 11));
|
||||
var a11 = new matrix2x2(*(p1 + 0), *(p1 + 1), *(p1 + 3), *(p1 + 4));
|
||||
var a12 = new colum2(*(p1 + 2), *(p1 + 5));
|
||||
var a21 = new matrix2x2(*(p1 + 6), *(p1 + 7), *(p1 + 9), *(p1 + 10));
|
||||
var a22 = new colum2(*(p1 + 8), *(p1 + 11));
|
||||
|
||||
var b11 = new Matrix2x2(*(p2 + 0), *(p2 + 1), *(p2 + 4), *(p2 + 5));
|
||||
var b12 = new Matrix2x2(*(p2 + 2), *(p2 + 3), *(p2 + 6), *(p2 + 7));
|
||||
var b11 = new matrix2x2 (*(p2 + 0), *(p2 + 1), *(p2 + 4), *(p2 + 5));
|
||||
var b12 = new matrix2x2(*(p2 + 2), *(p2 + 3), *(p2 + 6), *(p2 + 7));
|
||||
var b21 = matrix2.row3.Point1;
|
||||
var b22 = matrix2.row3.Point2;
|
||||
|
||||
@@ -970,11 +970,11 @@ namespace StgSharp.Math
|
||||
var c21 = a21.multiple(b11) + a22.multiple(b21);
|
||||
var c22 = a21.multiple(b12) + a22.multiple(b22);
|
||||
|
||||
return new Matrix4x4(
|
||||
new Vec4D(c11.row1, c12.row1),
|
||||
new Vec4D(c11.row2, c12.row2),
|
||||
new Vec4D(c21.row1, c22.row1),
|
||||
new Vec4D(c21.row2, c22.row2)
|
||||
return new matrix4x4(
|
||||
new vec4d(c11.row1, c12.row1),
|
||||
new vec4d(c11.row2, c12.row2),
|
||||
new vec4d(c21.row1, c22.row1),
|
||||
new vec4d(c21.row2, c22.row2)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -984,20 +984,20 @@ namespace StgSharp.Math
|
||||
/// <param name="matrix1"></param>
|
||||
/// <param name="matrix2"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe Matrix4x4 multiple(this Matrix4x4 matrix1, Matrix4x4 matrix2)
|
||||
public static unsafe matrix4x4 multiple(this matrix4x4 matrix1, matrix4x4 matrix2)
|
||||
{
|
||||
float* p1 = &matrix1.row1.X;
|
||||
float* p2 = &matrix2.row1.X;
|
||||
|
||||
Matrix2x2 a11 = new Matrix2x2(*p1, *(p1 + 1), *(p1 + 4), *(p1 + 5));
|
||||
Matrix2x2 a12 = new Matrix2x2(*(p1 + 2), *(p1 + 3), *(p1 + 6), *(p1 + 7));
|
||||
Matrix2x2 a21 = new Matrix2x2(*(p1 + 8), *(p1 + 9), *(p1 + 12), *(p1 + 13));
|
||||
Matrix2x2 a22 = new Matrix2x2(*(p1 + 10), *(p1 + 11), *(p1 + 14), *(p1 + 15));
|
||||
matrix2x2 a11 = new matrix2x2(*p1, *(p1 + 1), *(p1 + 4), *(p1 + 5));
|
||||
matrix2x2 a12 = new matrix2x2(*(p1 + 2), *(p1 + 3), *(p1 + 6), *(p1 + 7));
|
||||
matrix2x2 a21 = new matrix2x2(*(p1 + 8), *(p1 + 9), *(p1 + 12), *(p1 + 13));
|
||||
matrix2x2 a22 = new matrix2x2(*(p1 + 10), *(p1 + 11), *(p1 + 14), *(p1 + 15));
|
||||
|
||||
Matrix2x2 b11 = new Matrix2x2(*p1, *(p1 + 1), *(p1 + 4), *(p1 + 5));
|
||||
Matrix2x2 b12 = new Matrix2x2(*(p1 + 2), *(p1 + 3), *(p1 + 6), *(p1 + 7));
|
||||
Matrix2x2 b21 = new Matrix2x2(*(p1 + 8), *(p1 + 9), *(p1 + 12), *(p1 + 13));
|
||||
Matrix2x2 b22 = new Matrix2x2(*(p1 + 10), *(p1 + 11), *(p1 + 14), *(p1 + 15));
|
||||
matrix2x2 b11 = new matrix2x2(*p1, *(p1 + 1), *(p1 + 4), *(p1 + 5));
|
||||
matrix2x2 b12 = new matrix2x2(*(p1 + 2), *(p1 + 3), *(p1 + 6), *(p1 + 7));
|
||||
matrix2x2 b21 = new matrix2x2(*(p1 + 8), *(p1 + 9), *(p1 + 12), *(p1 + 13));
|
||||
matrix2x2 b22 = new matrix2x2(*(p1 + 10), *(p1 + 11), *(p1 + 14), *(p1 + 15));
|
||||
|
||||
var s1 = a21 + a22;
|
||||
var s2 = s1 - a11;
|
||||
@@ -1025,11 +1025,11 @@ namespace StgSharp.Math
|
||||
var u6 = u3 - m4;
|
||||
var u7 = u3 + m5;
|
||||
|
||||
return new Matrix4x4(
|
||||
new Vec4D(u1.row1.X, u1.row1.Y, u5.row1.X, u5.row1.Y),
|
||||
new Vec4D(u1.row2.X, u1.row2.Y, u5.row2.X, u5.row2.Y),
|
||||
new Vec4D(u6.row1.X, u6.row1.Y, u7.row1.X, u7.row1.Y),
|
||||
new Vec4D(u6.row2.X, u6.row2.Y, u7.row2.X, u7.row2.Y)
|
||||
return new matrix4x4(
|
||||
new vec4d(u1.row1.X, u1.row1.Y, u5.row1.X, u5.row1.Y),
|
||||
new vec4d(u1.row2.X, u1.row2.Y, u5.row2.X, u5.row2.Y),
|
||||
new vec4d(u6.row1.X, u6.row1.Y, u7.row1.X, u7.row1.Y),
|
||||
new vec4d(u6.row2.X, u6.row2.Y, u7.row2.X, u7.row2.Y)
|
||||
);
|
||||
}
|
||||
|
||||
+11
-11
@@ -7,36 +7,36 @@ namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
public static Vec3D To3D(this Vec2D vec)
|
||||
public static vec3d To3D(this vec2d vec)
|
||||
{
|
||||
return new Vec3D(vec.X, vec.Y, 0.0f);
|
||||
return new vec3d(vec.X, vec.Y, 0.0f);
|
||||
}
|
||||
|
||||
public static Vec4D To4D(this Vec2D Vec)
|
||||
public static vec4d To4D(this vec2d Vec)
|
||||
{
|
||||
return new Vec4D(Vec.X, Vec.Y, 0, 0);
|
||||
return new vec4d(Vec.X, Vec.Y, 0, 0);
|
||||
}
|
||||
|
||||
public static Vec4D To4D(this Vec3D vec)
|
||||
public static vec4d To4D(this vec3d vec)
|
||||
{
|
||||
return new Vec4D(vec.X, vec.Y, vec.Z, 0);
|
||||
return new vec4d(vec.X, vec.Y, vec.Z, 0);
|
||||
}
|
||||
|
||||
public static Vec2D To2D(Vec3D vec, CordinatePlain plain)
|
||||
public static vec2d To2D(vec3d vec, CordinatePlain plain)
|
||||
{
|
||||
switch (plain)
|
||||
{
|
||||
case CordinatePlain.XY:
|
||||
return new Vec2D(vec.X, vec.Y);
|
||||
return new vec2d(vec.X, vec.Y);
|
||||
break;
|
||||
case CordinatePlain.YZ:
|
||||
return new Vec2D(vec.Y, vec.Z);
|
||||
return new vec2d(vec.Y, vec.Z);
|
||||
break;
|
||||
case CordinatePlain.XZ:
|
||||
return new Vec2D(vec.X, vec.Z);
|
||||
return new vec2d(vec.X, vec.Z);
|
||||
break;
|
||||
default:
|
||||
return default(Vec2D);
|
||||
return default(vec2d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -7,14 +7,14 @@ namespace StgSharp.Math
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
|
||||
public static float Cross(Vec2D vec1, Vec2D vec2)
|
||||
public static float Cross(vec2d vec1, vec2d vec2)
|
||||
{
|
||||
return vec1.X * vec2.Y - vec1.Y * vec2.X;
|
||||
}
|
||||
|
||||
public static Vec3D Cross(Vec3D vec1, Vec3D vec2)
|
||||
public static vec3d Cross(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
return new Vec3D(
|
||||
return new vec3d(
|
||||
vec1.Y * vec2.Z - vec1.Z * vec2.Y,
|
||||
vec1.X * vec2.Z - vec1.Z * vec2.X,
|
||||
vec1.X * vec2.Y - vec1.Y * vec2.X
|
||||
@@ -6,14 +6,14 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Colum2D:IEquatable<Colum2D>
|
||||
public struct colum2:IEquatable<colum2>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
[FieldOffset(4)]
|
||||
public float Y;
|
||||
|
||||
public Colum2D(float x,float y)
|
||||
public colum2(float x,float y)
|
||||
{
|
||||
X= x;
|
||||
Y= y;
|
||||
@@ -25,17 +25,17 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Colum2D))
|
||||
else if (obj.GetType() != typeof(colum2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Colum2D)obj);
|
||||
return this.Equals((colum2)obj);
|
||||
}
|
||||
}
|
||||
|
||||
bool IEquatable<Colum2D>.Equals(Colum2D other)
|
||||
bool IEquatable<colum2>.Equals(colum2 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -57,30 +57,30 @@ namespace StgSharp.Math
|
||||
return $"{X}\n{Y}";
|
||||
}
|
||||
|
||||
public static Colum2D operator +(Colum2D c1,Colum2D c2)
|
||||
public static colum2 operator +(colum2 c1,colum2 c2)
|
||||
{
|
||||
return new Colum2D(
|
||||
return new colum2(
|
||||
c1.X + c2.X,
|
||||
c1.Y + c2.Y
|
||||
);
|
||||
}
|
||||
|
||||
public static Colum2D operator -(Colum2D c1, Colum2D c2)
|
||||
public static colum2 operator -(colum2 c1, colum2 c2)
|
||||
{
|
||||
return new Colum2D(
|
||||
return new colum2(
|
||||
c1.X - c2.X,
|
||||
c1.Y - c2.Y
|
||||
);
|
||||
}
|
||||
|
||||
public static Colum2D operator *(Colum2D colum, float x)
|
||||
public static colum2 operator *(colum2 colum, float x)
|
||||
{
|
||||
return new Colum2D(colum.X * x,colum.Y * x);
|
||||
return new colum2(colum.X * x,colum.Y * x);
|
||||
}
|
||||
|
||||
public static Colum2D operator /(Colum2D colum, float x)
|
||||
public static colum2 operator /(colum2 colum, float x)
|
||||
{
|
||||
return new Colum2D(colum.X / x, colum.Y / x);
|
||||
return new colum2(colum.X / x, colum.Y / x);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Colum3D : IEquatable<Colum3D>
|
||||
public struct colum3 : IEquatable<colum3>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
@@ -15,14 +15,14 @@ namespace StgSharp.Math
|
||||
[FieldOffset(8)]
|
||||
public float Z;
|
||||
|
||||
public Colum3D(float x, float y, float z)
|
||||
public colum3(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
bool IEquatable<Colum3D>.Equals(Colum3D other)
|
||||
bool IEquatable<colum3>.Equals(colum3 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -42,13 +42,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Colum3D))
|
||||
else if (obj.GetType() != typeof(colum3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Colum3D)obj);
|
||||
return this.Equals((colum3)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,39 +62,39 @@ namespace StgSharp.Math
|
||||
return $"{X}\t{Y}\t{Z}";
|
||||
}
|
||||
|
||||
public static bool operator ==(Colum3D vec1, Colum3D vec2)
|
||||
public static bool operator ==(colum3 vec1, colum3 vec2)
|
||||
{
|
||||
return vec1.X == vec2.X
|
||||
&& vec1.Y == vec2.Y
|
||||
&& vec1.Z == vec2.Z;
|
||||
}
|
||||
|
||||
public static bool operator !=(Colum3D vec1, Colum3D vec2)
|
||||
public static bool operator !=(colum3 vec1, colum3 vec2)
|
||||
{
|
||||
return !(vec1.X == vec2.X
|
||||
&& vec1.Y == vec2.Y
|
||||
&& vec1.Z == vec2.Z);
|
||||
}
|
||||
|
||||
public static Colum3D operator +(Colum3D vec1, Colum3D vec2)
|
||||
public static colum3 operator +(colum3 vec1, colum3 vec2)
|
||||
{
|
||||
return new Colum3D(
|
||||
return new colum3(
|
||||
vec1.X + vec2.X,
|
||||
vec1.Y + vec2.Y,
|
||||
vec1.Z + vec2.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static Colum3D operator -(Colum3D vec1, Colum3D vec2)
|
||||
public static colum3 operator -(colum3 vec1, colum3 vec2)
|
||||
{
|
||||
return new Colum3D(
|
||||
return new colum3(
|
||||
vec1.X - vec2.X,
|
||||
vec1.Y - vec2.Y,
|
||||
vec1.Z - vec2.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static float operator *(Colum3D vec1, Colum3D vec2)
|
||||
public static float operator *(colum3 vec1, colum3 vec2)
|
||||
{
|
||||
return
|
||||
vec1.X * vec2.X
|
||||
@@ -102,18 +102,18 @@ namespace StgSharp.Math
|
||||
+ vec1.Z + vec2.Z;
|
||||
}
|
||||
|
||||
public static Colum3D operator *(Colum3D vec, float x)
|
||||
public static colum3 operator *(colum3 vec, float x)
|
||||
{
|
||||
return new Colum3D(
|
||||
return new colum3(
|
||||
vec.X * x,
|
||||
vec.Y * x,
|
||||
vec.Z * x
|
||||
);
|
||||
}
|
||||
|
||||
public static Colum3D operator /(Colum3D vec, float x)
|
||||
public static colum3 operator /(colum3 vec, float x)
|
||||
{
|
||||
return new Colum3D(
|
||||
return new colum3(
|
||||
vec.X / x,
|
||||
vec.Y / x,
|
||||
vec.Z / x
|
||||
@@ -7,7 +7,7 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Colum4D:IEquatable<Colum4D>
|
||||
public struct colum4:IEquatable<colum4>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
@@ -18,7 +18,7 @@ namespace StgSharp.Math
|
||||
[FieldOffset(12)]
|
||||
public float W;
|
||||
|
||||
public Colum4D(float x, float y, float z, float w)
|
||||
public colum4(float x, float y, float z, float w)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
@@ -26,7 +26,7 @@ namespace StgSharp.Math
|
||||
W = w;
|
||||
}
|
||||
|
||||
public bool Equals(Colum4D other)
|
||||
public bool Equals(colum4 other)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
@@ -7,32 +7,32 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix2x2:IEquatable<Matrix2x2>
|
||||
public struct matrix2x2:IEquatable<matrix2x2>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec2D row1;
|
||||
public vec2d row1;
|
||||
[FieldOffset(8)]
|
||||
public Vec2D row2;
|
||||
public vec2d row2;
|
||||
|
||||
|
||||
public Matrix2x2(Vec2D c0, Vec2D c1)
|
||||
public matrix2x2(vec2d c0, vec2d c1)
|
||||
{
|
||||
row1 = c0;
|
||||
row2 = c1;
|
||||
}
|
||||
|
||||
public Matrix2x2(
|
||||
public matrix2x2(
|
||||
float a11,
|
||||
float a12,
|
||||
float a21,
|
||||
float a22
|
||||
)
|
||||
{
|
||||
row1 = new Vec2D(a11, a12);
|
||||
row2 = new Vec2D(a21, a22);
|
||||
row1 = new vec2d(a11, a12);
|
||||
row2 = new vec2d(a21, a22);
|
||||
}
|
||||
|
||||
bool IEquatable<Matrix2x2>.Equals(Matrix2x2 other)
|
||||
bool IEquatable<matrix2x2>.Equals(matrix2x2 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -52,13 +52,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Matrix2x2))
|
||||
else if (obj.GetType() != typeof(matrix2x2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec3D)obj);
|
||||
return this.Equals((vec3d)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,17 +72,17 @@ namespace StgSharp.Math
|
||||
return $"{row1}\n{row2}";
|
||||
}
|
||||
|
||||
public static Matrix2x2 operator +(Matrix2x2 matrix1 , Matrix2x2 matrix2)
|
||||
public static matrix2x2 operator +(matrix2x2 matrix1 , matrix2x2 matrix2)
|
||||
{
|
||||
return new Matrix2x2(
|
||||
return new matrix2x2(
|
||||
matrix1.row1 + matrix2.row1,
|
||||
matrix1.row2 + matrix2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x2 operator -(Matrix2x2 matrix1, Matrix2x2 matrix2)
|
||||
public static matrix2x2 operator -(matrix2x2 matrix1, matrix2x2 matrix2)
|
||||
{
|
||||
return new Matrix2x2(
|
||||
return new matrix2x2(
|
||||
matrix1.row1 - matrix2.row1,
|
||||
matrix1.row2 - matrix2.row2
|
||||
);
|
||||
@@ -7,26 +7,26 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix2x3:IEquatable<Matrix2x3>
|
||||
public struct matrix2x3:IEquatable<matrix2x3>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec3D row1;
|
||||
public vec3d row1;
|
||||
[FieldOffset(12)]
|
||||
public Vec3D row2;
|
||||
public vec3d row2;
|
||||
|
||||
public Matrix2x3(Vec3D r1, Vec3D r2)
|
||||
public matrix2x3(vec3d r1, vec3d r2)
|
||||
{
|
||||
row1 = r1;
|
||||
row2 = r2;
|
||||
}
|
||||
|
||||
public Matrix2x3(
|
||||
public matrix2x3(
|
||||
float r11, float r12, float r13,
|
||||
float r21, float r22, float r23
|
||||
)
|
||||
{
|
||||
row1 = new Vec3D(r11, r12, r13);
|
||||
row2 = new Vec3D(r21, r22, r23);
|
||||
row1 = new vec3d(r11, r12, r13);
|
||||
row2 = new vec3d(r21, r22, r23);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -35,13 +35,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Matrix2x3))
|
||||
else if (obj.GetType() != typeof(matrix2x3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec3D)obj);
|
||||
return this.Equals((vec3d)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace StgSharp.Math
|
||||
return $"{row1}\n{row2}";
|
||||
}
|
||||
|
||||
bool IEquatable<Matrix2x3>.Equals(Matrix2x3 other)
|
||||
bool IEquatable<matrix2x3>.Equals(matrix2x3 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -69,33 +69,33 @@ namespace StgSharp.Math
|
||||
}
|
||||
}
|
||||
|
||||
public static Matrix2x3 operator +(Matrix2x3 matrix1, Matrix2x3 matrix2)
|
||||
public static matrix2x3 operator +(matrix2x3 matrix1, matrix2x3 matrix2)
|
||||
{
|
||||
return new Matrix2x3(
|
||||
return new matrix2x3(
|
||||
matrix1.row1 + matrix2.row1,
|
||||
matrix1.row2 + matrix2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x3 operator -(Matrix2x3 matrix1, Matrix2x3 matrix2)
|
||||
public static matrix2x3 operator -(matrix2x3 matrix1, matrix2x3 matrix2)
|
||||
{
|
||||
return new Matrix2x3(
|
||||
return new matrix2x3(
|
||||
matrix1.row1 - matrix2.row1,
|
||||
matrix1.row2 - matrix2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x3 operator *(Matrix2x3 array, float x)
|
||||
public static matrix2x3 operator *(matrix2x3 array, float x)
|
||||
{
|
||||
return new Matrix2x3(
|
||||
return new matrix2x3(
|
||||
array.row1 * x,
|
||||
array.row2 * x
|
||||
) ;
|
||||
}
|
||||
|
||||
public static Matrix2x3 operator /(Matrix2x3 array, float x)
|
||||
public static matrix2x3 operator /(matrix2x3 array, float x)
|
||||
{
|
||||
return new Matrix2x3(
|
||||
return new matrix2x3(
|
||||
array.row1 / x,
|
||||
array.row2 / x
|
||||
);
|
||||
@@ -7,29 +7,29 @@ namespace StgSharp.Math
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix2x4 : IEquatable<Matrix2x4>
|
||||
public struct matrix2x4 : IEquatable<matrix2x4>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec4D row1;
|
||||
public vec4d row1;
|
||||
[FieldOffset(16)]
|
||||
public Vec4D row2;
|
||||
public vec4d row2;
|
||||
|
||||
public Matrix2x4(Vec4D r1,Vec4D r2)
|
||||
public matrix2x4( vec4d r1, vec4d r2)
|
||||
{
|
||||
row1 = r1;
|
||||
row2 = r2;
|
||||
}
|
||||
|
||||
public Matrix2x4(
|
||||
public matrix2x4(
|
||||
float a11, float a12, float a13, float a14,
|
||||
float a21, float a22, float a23, float a24
|
||||
)
|
||||
{
|
||||
row1 = new Vec4D(a11,a12,a13,a14);
|
||||
row2 = new Vec4D(a21,a22,a23,a24);
|
||||
row1 = new vec4d(a11,a12,a13,a14);
|
||||
row2 = new vec4d(a21,a22,a23,a24);
|
||||
}
|
||||
|
||||
public bool Equals(Matrix2x4 other)
|
||||
public bool Equals(matrix2x4 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -48,13 +48,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Matrix2x4))
|
||||
else if (obj.GetType() != typeof(matrix2x4))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Matrix2x4)obj);
|
||||
return this.Equals((matrix2x4)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,33 +68,33 @@ namespace StgSharp.Math
|
||||
return $"{this.row1}\n{this.row2}";
|
||||
}
|
||||
|
||||
public static Matrix2x4 operator +(Matrix2x4 matrix1 ,Matrix2x4 matrix2)
|
||||
public static matrix2x4 operator +(matrix2x4 matrix1 ,matrix2x4 matrix2)
|
||||
{
|
||||
return new Matrix2x4(
|
||||
return new matrix2x4(
|
||||
matrix1.row1 + matrix2.row1,
|
||||
matrix1.row2 + matrix2.row2
|
||||
) ;
|
||||
}
|
||||
|
||||
public static Matrix2x4 operator -(Matrix2x4 matrix1, Matrix2x4 matrix2)
|
||||
public static matrix2x4 operator -(matrix2x4 matrix1, matrix2x4 matrix2)
|
||||
{
|
||||
return new Matrix2x4(
|
||||
return new matrix2x4(
|
||||
matrix1.row1 - matrix2.row1,
|
||||
matrix1.row2 - matrix2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x4 operator *(Matrix2x4 array, float x)
|
||||
public static matrix2x4 operator *(matrix2x4 array, float x)
|
||||
{
|
||||
return new Matrix2x4(
|
||||
return new matrix2x4(
|
||||
array.row1 * x,
|
||||
array.row2 * x
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x4 operator /(Matrix2x4 array, float x)
|
||||
public static matrix2x4 operator /(matrix2x4 array, float x)
|
||||
{
|
||||
return new Matrix2x4(
|
||||
return new matrix2x4(
|
||||
array.row1 / x,
|
||||
array.row2 / x
|
||||
);
|
||||
@@ -6,34 +6,34 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix3x2:IEquatable<Matrix3x2>
|
||||
public struct matrix3x2:IEquatable<matrix3x2>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec2D row1;
|
||||
public vec2d row1;
|
||||
[FieldOffset(8)]
|
||||
public Vec2D row2;
|
||||
public vec2d row2;
|
||||
[FieldOffset(16)]
|
||||
public Vec2D row3;
|
||||
public vec2d row3;
|
||||
|
||||
public Matrix3x2(Vec2D r1,Vec2D r2,Vec2D r3)
|
||||
public matrix3x2(vec2d r1,vec2d r2,vec2d r3)
|
||||
{
|
||||
row1= r1;
|
||||
row2= r2;
|
||||
row3= r3;
|
||||
}
|
||||
|
||||
public Matrix3x2(
|
||||
public matrix3x2(
|
||||
float a11, float a12,
|
||||
float a21, float a22,
|
||||
float a31, float a32
|
||||
)
|
||||
{
|
||||
row1 = new Vec2D(a11, a12);
|
||||
row2 = new Vec2D(a21, a22);
|
||||
row3 = new Vec2D(a31, a32);
|
||||
row1 = new vec2d(a11, a12);
|
||||
row2 = new vec2d(a21, a22);
|
||||
row3 = new vec2d(a31, a32);
|
||||
}
|
||||
|
||||
bool IEquatable<Matrix3x2>.Equals(Matrix3x2 other)
|
||||
bool IEquatable<matrix3x2>.Equals(matrix3x2 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -55,13 +55,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Matrix3x2))
|
||||
else if (obj.GetType() != typeof(matrix3x2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Matrix3x2)obj);
|
||||
return this.Equals((matrix3x2)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,18 +75,18 @@ namespace StgSharp.Math
|
||||
return $"{row1}\n{row2}\n{row3}";
|
||||
}
|
||||
|
||||
public static Matrix3x2 operator +(Matrix3x2 matrix1, Matrix3x2 matrix2)
|
||||
public static matrix3x2 operator +(matrix3x2 matrix1, matrix3x2 matrix2)
|
||||
{
|
||||
return new Matrix3x2(
|
||||
return new matrix3x2(
|
||||
matrix1.row1 + matrix2.row1,
|
||||
matrix1.row2 + matrix2.row2,
|
||||
matrix1.row3 + matrix2.row3
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x2 operator -(Matrix3x2 matrix1, Matrix3x2 matrix2)
|
||||
public static matrix3x2 operator -(matrix3x2 matrix1, matrix3x2 matrix2)
|
||||
{
|
||||
return new Matrix3x2(
|
||||
return new matrix3x2(
|
||||
matrix1.row1 - matrix2.row1,
|
||||
matrix1.row2 - matrix2.row2,
|
||||
matrix1.row3 - matrix2.row3
|
||||
@@ -7,31 +7,31 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix3x3:IEquatable<Matrix3x3>
|
||||
public struct matrix3x3:IEquatable<matrix3x3>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec3D row1;
|
||||
public vec3d row1;
|
||||
[FieldOffset(12)]
|
||||
public Vec3D row2;
|
||||
public vec3d row2;
|
||||
[FieldOffset(24)]
|
||||
public Vec3D row3;
|
||||
public vec3d row3;
|
||||
|
||||
public Matrix3x3(Vec3D r0,Vec3D r1,Vec3D r2)
|
||||
public matrix3x3(vec3d r0,vec3d r1,vec3d r2)
|
||||
{
|
||||
row1 = r0;
|
||||
row2 = r1;
|
||||
row3 = r2;
|
||||
}
|
||||
|
||||
public Matrix3x3(
|
||||
public matrix3x3(
|
||||
float a11,float a12,float a13,
|
||||
float a21,float a22,float a23,
|
||||
float a31,float a32,float a33
|
||||
)
|
||||
{
|
||||
row1 = new Vec3D(a11, a12, a13);
|
||||
row2 = new Vec3D(a21, a22, a23);
|
||||
row3 = new Vec3D(a31, a32, a33);
|
||||
row1 = new vec3d(a11, a12, a13);
|
||||
row2 = new vec3d(a21, a22, a23);
|
||||
row3 = new vec3d(a31, a32, a33);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
@@ -39,7 +39,7 @@ namespace StgSharp.Math
|
||||
return HashCode.Combine(row1,row2,row3);
|
||||
}
|
||||
|
||||
bool IEquatable<Matrix3x3>.Equals(Matrix3x3 other)
|
||||
bool IEquatable<matrix3x3>.Equals(matrix3x3 other)
|
||||
{
|
||||
if (this.GetHashCode()!=other.GetHashCode())
|
||||
{
|
||||
@@ -60,13 +60,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Matrix3x3))
|
||||
else if (obj.GetType() != typeof(matrix3x3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Matrix3x3)obj);
|
||||
return this.Equals((matrix3x3)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,19 +77,19 @@ namespace StgSharp.Math
|
||||
|
||||
|
||||
|
||||
public static bool operator ==(Matrix3x3 matrix1, Matrix3x3 matrix2)
|
||||
public static bool operator ==(matrix3x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
return matrix1.Equals(matrix2);
|
||||
}
|
||||
|
||||
public static bool operator !=(Matrix3x3 matrix1, Matrix3x3 matrix2)
|
||||
public static bool operator !=(matrix3x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
return !matrix1.Equals(matrix2);
|
||||
}
|
||||
|
||||
public static Matrix3x3 operator +(Matrix3x3 matrix1, Matrix3x3 matrix2)
|
||||
public static matrix3x3 operator +(matrix3x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
return new Matrix3x3(
|
||||
return new matrix3x3(
|
||||
matrix1.row1.X + matrix2.row1.X,
|
||||
matrix1.row1.Y + matrix2.row1.Y,
|
||||
matrix1.row1.Z + matrix2.row1.Z,
|
||||
@@ -104,9 +104,9 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x3 operator -(Matrix3x3 matrix1, Matrix3x3 matrix2)
|
||||
public static matrix3x3 operator -(matrix3x3 matrix1, matrix3x3 matrix2)
|
||||
{
|
||||
return new Matrix3x3(
|
||||
return new matrix3x3(
|
||||
matrix1.row1.X - matrix2.row1.X,
|
||||
matrix1.row1.Y - matrix2.row1.Y,
|
||||
matrix1.row1.Z - matrix2.row1.Z,
|
||||
@@ -123,18 +123,18 @@ namespace StgSharp.Math
|
||||
|
||||
|
||||
|
||||
public static Matrix3x3 operator *(Matrix3x3 array, float x)
|
||||
public static matrix3x3 operator *(matrix3x3 array, float x)
|
||||
{
|
||||
return new Matrix3x3(
|
||||
return new matrix3x3(
|
||||
array.row1 * x,
|
||||
array.row2 * x,
|
||||
array.row3 * x
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x3 operator /(Matrix3x3 array, float x)
|
||||
public static matrix3x3 operator /(matrix3x3 array, float x)
|
||||
{
|
||||
return new Matrix3x3(
|
||||
return new matrix3x3(
|
||||
array.row1/x,
|
||||
array.row2/x,
|
||||
array.row3/x
|
||||
@@ -8,17 +8,17 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix3x4:IEquatable<Matrix3x4>
|
||||
public struct matrix3x4:IEquatable<matrix3x4>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec4D row1;
|
||||
public vec4d row1;
|
||||
[FieldOffset(16)]
|
||||
public Vec4D row2;
|
||||
public vec4d row2;
|
||||
[FieldOffset(32)]
|
||||
public Vec4D row3;
|
||||
public vec4d row3;
|
||||
|
||||
public Matrix3x4(
|
||||
Vec4D r1, Vec4D r2, Vec4D r3
|
||||
public matrix3x4(
|
||||
vec4d r1,vec4d r2,vec4d r3
|
||||
)
|
||||
{
|
||||
this.row1 = r1;
|
||||
@@ -26,15 +26,15 @@ namespace StgSharp.Math
|
||||
this.row3 = r3;
|
||||
}
|
||||
|
||||
public Matrix3x4(
|
||||
public matrix3x4(
|
||||
float a11, float a12, float a13, float a14,
|
||||
float a21, float a22, float a23, float a24,
|
||||
float a31, float a32, float a33, float a34
|
||||
)
|
||||
{
|
||||
row1 = new Vec4D(a11,a12,a13,a14);
|
||||
row2 = new Vec4D(a21,a22,a23,a24);
|
||||
row3 = new Vec4D(a31,a32,a33,a34);
|
||||
row1 = new vec4d(a11,a12,a13,a14);
|
||||
row2 = new vec4d(a21,a22,a23,a24);
|
||||
row3 = new vec4d(a31,a32,a33,a34);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -43,17 +43,17 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Matrix3x4))
|
||||
else if (obj.GetType() != typeof(matrix3x4))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Matrix3x4)obj);
|
||||
return this.Equals((matrix3x4)obj);
|
||||
}
|
||||
}
|
||||
|
||||
bool IEquatable<Matrix3x4>.Equals(Matrix3x4 other)
|
||||
bool IEquatable<matrix3x4>.Equals(matrix3x4 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -6,18 +6,18 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix4x2:IEquatable<Matrix4x2>
|
||||
public struct matrix4x2:IEquatable<matrix4x2>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec2D row1;
|
||||
public vec2d row1;
|
||||
[FieldOffset(8)]
|
||||
public Vec2D row2;
|
||||
public vec2d row2;
|
||||
[FieldOffset(16)]
|
||||
public Vec2D row3;
|
||||
public vec2d row3;
|
||||
[FieldOffset(24)]
|
||||
public Vec2D row4;
|
||||
public vec2d row4;
|
||||
|
||||
public Matrix4x2(Vec2D r1, Vec2D r2, Vec2D r3, Vec2D r4)
|
||||
public matrix4x2(vec2d r1, vec2d r2, vec2d r3, vec2d r4)
|
||||
{
|
||||
row1 = r1;
|
||||
row2 = r2;
|
||||
@@ -25,17 +25,17 @@ namespace StgSharp.Math
|
||||
row4 = r4;
|
||||
}
|
||||
|
||||
public Matrix4x2(
|
||||
public matrix4x2(
|
||||
float a11, float a12,
|
||||
float a21, float a22,
|
||||
float a31, float a32,
|
||||
float a41, float a42
|
||||
)
|
||||
{
|
||||
row1 = new Vec2D(a11, a12);
|
||||
row2 = new Vec2D(a21, a22);
|
||||
row3 = new Vec2D(a31, a32);
|
||||
row4 = new Vec2D(a41, a42);
|
||||
row1 = new vec2d(a11, a12);
|
||||
row2 = new vec2d(a21, a22);
|
||||
row3 = new vec2d(a31, a32);
|
||||
row4 = new vec2d(a41, a42);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -44,13 +44,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() == typeof(Matrix4x2))
|
||||
else if (obj.GetType() == typeof(matrix4x2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Matrix4x2)obj);
|
||||
return this.Equals((matrix4x2)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace StgSharp.Math
|
||||
return $"{row1}\n{row2}\n{row3}\n{row4}";
|
||||
}
|
||||
|
||||
bool IEquatable<Matrix4x2>.Equals(Matrix4x2 other)
|
||||
bool IEquatable<matrix4x2>.Equals(matrix4x2 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -7,28 +7,28 @@ namespace StgSharp.Math
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix4x3:IEquatable<Matrix4x3>
|
||||
public struct matrix4x3:IEquatable<matrix4x3>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec3D row1;
|
||||
public vec3d row1;
|
||||
[FieldOffset(12)]
|
||||
public Vec3D row2;
|
||||
public vec3d row2;
|
||||
[FieldOffset(24)]
|
||||
public Vec3D row3;
|
||||
public vec3d row3;
|
||||
[FieldOffset(36)]
|
||||
public Vec3D row4;
|
||||
public vec3d row4;
|
||||
|
||||
public Matrix4x3(
|
||||
public matrix4x3(
|
||||
float a11, float a12, float a13,
|
||||
float a21, float a22, float a23,
|
||||
float a31, float a32, float a33,
|
||||
float a41, float a42, float a43
|
||||
)
|
||||
{
|
||||
row1 = new Vec3D(a11, a12, a13);
|
||||
row2 = new Vec3D(a21, a22, a23);
|
||||
row3 = new Vec3D(a31, a32, a33);
|
||||
row4 = new Vec3D(a41, a42, a43);
|
||||
row1 = new vec3d(a11, a12, a13);
|
||||
row2 = new vec3d(a21, a22, a23);
|
||||
row3 = new vec3d(a31, a32, a33);
|
||||
row4 = new vec3d(a41, a42, a43);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -37,17 +37,17 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Matrix4x3))
|
||||
else if (obj.GetType() != typeof(matrix4x3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Matrix4x3)obj);
|
||||
return this.Equals((matrix4x3)obj);
|
||||
}
|
||||
}
|
||||
|
||||
bool IEquatable<Matrix4x3>.Equals(Matrix4x3 other)
|
||||
bool IEquatable<matrix4x3>.Equals(matrix4x3 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -6,18 +6,18 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Matrix4x4:IEquatable<Matrix4x4>
|
||||
public struct matrix4x4:IEquatable<matrix4x4>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec4D row1;
|
||||
public vec4d row1;
|
||||
[FieldOffset(16)]
|
||||
public Vec4D row2;
|
||||
public vec4d row2;
|
||||
[FieldOffset(32)]
|
||||
public Vec4D row3;
|
||||
public vec4d row3;
|
||||
[FieldOffset(48)]
|
||||
public Vec4D row4;
|
||||
public vec4d row4;
|
||||
|
||||
public Matrix4x4(Vec4D r1, Vec4D r2, Vec4D r3, Vec4D r4)
|
||||
public matrix4x4( vec4d r1,vec4d r2,vec4d r3,vec4d r4)
|
||||
{
|
||||
row1 = r1;
|
||||
row2 = r2;
|
||||
@@ -25,17 +25,17 @@ namespace StgSharp.Math
|
||||
row4 = r4;
|
||||
}
|
||||
|
||||
public Matrix4x4(
|
||||
public matrix4x4(
|
||||
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(a21, a22, a23, a24);
|
||||
row3 = new Vec4D(a31, a32, a33, a34);
|
||||
row4 = new Vec4D(a41, a42, a43, a44);
|
||||
row1 = new vec4d(a11, a12, a13, a14);
|
||||
row2 = new vec4d(a21, a22, a23, a24);
|
||||
row3 = new vec4d(a31, a32, a33, a34);
|
||||
row4 = new vec4d(a41, a42, a43, a44);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
@@ -43,7 +43,7 @@ namespace StgSharp.Math
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
bool IEquatable<Matrix4x4>.Equals(Matrix4x4 other)
|
||||
bool IEquatable<matrix4x4>.Equals(matrix4x4 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -68,9 +68,9 @@ namespace StgSharp.Math
|
||||
return $"{this.row1}\n{this.row2}\n{this.row3}\n{this.row4}";
|
||||
}
|
||||
|
||||
public static Matrix4x4 operator +(Matrix4x4 matrix1, Matrix4x4 matrix2)
|
||||
public static matrix4x4 operator +(matrix4x4 matrix1, matrix4x4 matrix2)
|
||||
{
|
||||
return new Matrix4x4(
|
||||
return new matrix4x4(
|
||||
matrix1.row1 + matrix2.row1,
|
||||
matrix1.row2 + matrix2.row2,
|
||||
matrix1.row3 + matrix2.row3,
|
||||
@@ -78,9 +78,9 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x4 operator -(Matrix4x4 matrix1, Matrix4x4 matrix2)
|
||||
public static matrix4x4 operator -(matrix4x4 matrix1, matrix4x4 matrix2)
|
||||
{
|
||||
return new Matrix4x4(
|
||||
return new matrix4x4(
|
||||
matrix1.row1 - matrix2.row1,
|
||||
matrix1.row2 - matrix2.row2,
|
||||
matrix1.row3 - matrix2.row3,
|
||||
@@ -88,9 +88,9 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x4 operator *(Matrix4x4 array, float x)
|
||||
public static matrix4x4 operator *(matrix4x4 array, float x)
|
||||
{
|
||||
return new Matrix4x4(
|
||||
return new matrix4x4(
|
||||
array.row1 * x,
|
||||
array.row2 * x,
|
||||
array.row3 * x,
|
||||
@@ -9,20 +9,20 @@ namespace StgSharp.Math
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Vec2D:IEquatable<Vec2D>
|
||||
public struct vec2d:IEquatable<vec2d>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
[FieldOffset(sizeof(float))]
|
||||
public float Y;
|
||||
|
||||
public Vec2D(float x,float y)
|
||||
public vec2d(float x,float y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public bool Equals(Vec2D other)
|
||||
public bool Equals(vec2d other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -40,13 +40,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Vec2D))
|
||||
else if (obj.GetType() != typeof(vec2d))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec2D)obj);
|
||||
return this.Equals((vec2d)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,34 +60,34 @@ namespace StgSharp.Math
|
||||
return $"{this.X}\t{this.Y}";
|
||||
}
|
||||
|
||||
public static bool operator ==(Vec2D vec1, Vec2D vec2)
|
||||
public static bool operator ==(vec2d vec1, vec2d vec2)
|
||||
{
|
||||
return vec1.X==vec2.X && vec1.Y==vec2.Y;
|
||||
}
|
||||
|
||||
public static bool operator !=(Vec2D vec1, Vec2D vec2)
|
||||
public static bool operator !=(vec2d vec1, vec2d vec2)
|
||||
{
|
||||
return !(vec1.X == vec2.X && vec1.Y == vec2.Y);
|
||||
}
|
||||
|
||||
public static Vec2D operator +(Vec2D vec1, Vec2D vec2)
|
||||
public static vec2d operator +(vec2d vec1, vec2d vec2)
|
||||
{
|
||||
return new Vec2D(vec1.X + vec2.X, vec1.Y + vec2.Y);
|
||||
return new vec2d(vec1.X + vec2.X, vec1.Y + vec2.Y);
|
||||
}
|
||||
|
||||
public static Vec2D operator -(Vec2D vec1, Vec2D vec2)
|
||||
public static vec2d operator -(vec2d vec1, vec2d vec2)
|
||||
{
|
||||
return new Vec2D(vec1.X - vec2.X, vec1.Y - vec2.Y);
|
||||
return new vec2d(vec1.X - vec2.X, vec1.Y - vec2.Y);
|
||||
}
|
||||
|
||||
public static Vec2D operator *(Vec2D vec, float x)
|
||||
public static vec2d operator *(vec2d vec, float x)
|
||||
{
|
||||
return new Vec2D(vec.X * x, vec.Y * x);
|
||||
return new vec2d(vec.X * x, vec.Y * x);
|
||||
}
|
||||
|
||||
public static Vec2D operator /(Vec2D vec, float x)
|
||||
public static vec2d operator /(vec2d vec, float x)
|
||||
{
|
||||
return new Vec2D(vec.X/x, vec.Y/x);
|
||||
return new vec2d(vec.X/x, vec.Y/x);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Vec3D : IEquatable<Vec3D>
|
||||
public struct vec3d : IEquatable<vec3d>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
@@ -16,14 +16,14 @@ namespace StgSharp.Math
|
||||
[FieldOffset(8)]
|
||||
public float Z;
|
||||
|
||||
public Vec3D(float x, float y, float z)
|
||||
public vec3d(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
bool IEquatable<Vec3D>.Equals(Vec3D other)
|
||||
bool IEquatable<vec3d>.Equals(vec3d other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -43,13 +43,13 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Vec3D))
|
||||
else if (obj.GetType() != typeof(vec3d))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec3D)obj);
|
||||
return this.Equals((vec3d)obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,39 +63,39 @@ namespace StgSharp.Math
|
||||
return $"{X}\t{Y}\t{Z}";
|
||||
}
|
||||
|
||||
public static bool operator ==(Vec3D vec1,Vec3D vec2)
|
||||
public static bool operator ==(vec3d vec1,vec3d vec2)
|
||||
{
|
||||
return vec1.X == vec2.X
|
||||
&& vec1.Y == vec2.Y
|
||||
&& vec1.Z == vec2.Z;
|
||||
}
|
||||
|
||||
public static bool operator !=(Vec3D vec1, Vec3D vec2)
|
||||
public static bool operator !=(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
return !(vec1.X == vec2.X
|
||||
&& vec1.Y == vec2.Y
|
||||
&& vec1.Z == vec2.Z);
|
||||
}
|
||||
|
||||
public static Vec3D operator +(Vec3D vec1, Vec3D vec2)
|
||||
public static vec3d operator +(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
return new Vec3D(
|
||||
return new vec3d(
|
||||
vec1.X + vec2.X,
|
||||
vec1.Y + vec2.Y,
|
||||
vec1.Z + vec2.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static Vec3D operator -(Vec3D vec1, Vec3D vec2)
|
||||
public static vec3d operator -(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
return new Vec3D(
|
||||
return new vec3d(
|
||||
vec1.X - vec2.X,
|
||||
vec1.Y - vec2.Y,
|
||||
vec1.Z - vec2.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static float operator *(Vec3D vec1, Vec3D vec2)
|
||||
public static float operator *(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
return
|
||||
vec1.X * vec2.X
|
||||
@@ -103,18 +103,18 @@ namespace StgSharp.Math
|
||||
+ vec1.Z + vec2.Z;
|
||||
}
|
||||
|
||||
public static Vec3D operator *(Vec3D vec, float x)
|
||||
public static vec3d operator *(vec3d vec, float x)
|
||||
{
|
||||
return new Vec3D(
|
||||
return new vec3d(
|
||||
vec.X * x,
|
||||
vec.Y * x,
|
||||
vec.Z * x
|
||||
);
|
||||
}
|
||||
|
||||
public static Vec3D operator /(Vec3D vec, float x)
|
||||
public static vec3d operator /(vec3d vec, float x)
|
||||
{
|
||||
return new Vec3D(
|
||||
return new vec3d(
|
||||
vec.X / x,
|
||||
vec.Y / x,
|
||||
vec.Z / x
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Vec4D:IEquatable<Vec4D>
|
||||
public struct vec4d:IEquatable< vec4d>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
@@ -22,14 +22,14 @@ namespace StgSharp.Math
|
||||
|
||||
|
||||
[FieldOffset(0)]
|
||||
public Vec2D Point1;
|
||||
public vec2d Point1;
|
||||
[FieldOffset(8)]
|
||||
public Vec2D Point2;
|
||||
public vec2d Point2;
|
||||
|
||||
public Vec4D(float a1,float a2,float a3,float a4)
|
||||
public vec4d(float a1,float a2,float a3,float a4)
|
||||
{
|
||||
Point1= default(Vec2D);
|
||||
Point2= default(Vec2D);
|
||||
Point1= default(vec2d);
|
||||
Point2= default(vec2d);
|
||||
|
||||
X = a1;
|
||||
Y = a2;
|
||||
@@ -37,7 +37,7 @@ namespace StgSharp.Math
|
||||
W = a4;
|
||||
}
|
||||
|
||||
public Vec4D(Vec2D p1,Vec2D p2)
|
||||
public vec4d(vec2d p1,vec2d p2)
|
||||
{
|
||||
X= 0;
|
||||
Y= 0;
|
||||
@@ -54,17 +54,17 @@ namespace StgSharp.Math
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(obj.GetType() != typeof(Vec4D))
|
||||
else if(obj.GetType() != typeof( vec4d))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this == (Vec4D)obj;
|
||||
return this == ( vec4d)obj;
|
||||
}
|
||||
}
|
||||
|
||||
bool IEquatable<Vec4D>.Equals(Vec4D other)
|
||||
bool IEquatable< vec4d>.Equals( vec4d other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
@@ -89,19 +89,19 @@ namespace StgSharp.Math
|
||||
return $"{X}\t{Y}\t{Z}\t{W}";
|
||||
}
|
||||
|
||||
public static bool operator ==(Vec4D vec1, Vec4D vec2)
|
||||
public static bool operator ==( vec4d vec1, vec4d vec2)
|
||||
{
|
||||
return vec1.Equals(vec2);
|
||||
}
|
||||
|
||||
public static bool operator !=(Vec4D vec1, Vec4D vec2)
|
||||
public static bool operator !=( vec4d vec1, vec4d vec2)
|
||||
{
|
||||
return !vec1.Equals(vec2);
|
||||
}
|
||||
|
||||
public static Vec4D operator +(Vec4D vec1, Vec4D vec2)
|
||||
public static vec4d operator +( vec4d vec1, vec4d vec2)
|
||||
{
|
||||
return new Vec4D(
|
||||
return new vec4d(
|
||||
vec1.X + vec2.X,
|
||||
vec1.Y + vec2.Y,
|
||||
vec1.Z + vec2.Z,
|
||||
@@ -109,9 +109,9 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static Vec4D operator -(Vec4D vec1, Vec4D vec2)
|
||||
public static vec4d operator -( vec4d vec1, vec4d vec2)
|
||||
{
|
||||
return new Vec4D(
|
||||
return new vec4d(
|
||||
vec1.X - vec2.X,
|
||||
vec1.Y - vec2.Y,
|
||||
vec1.Z - vec2.Z,
|
||||
@@ -119,7 +119,7 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static float operator *(Vec4D vec1, Vec4D vec2)
|
||||
public static float operator *( vec4d vec1, vec4d vec2)
|
||||
{
|
||||
return
|
||||
vec1.X * vec2.X
|
||||
@@ -128,14 +128,14 @@ namespace StgSharp.Math
|
||||
+ vec1.W * vec2.W;
|
||||
}
|
||||
|
||||
public static Vec4D operator *(Vec4D vec, float x)
|
||||
public static vec4d operator *( vec4d vec, float x)
|
||||
{
|
||||
return new Vec4D(vec.X * x, vec.Y * x, vec.Z * x, vec.W * x ) ;
|
||||
return new vec4d(vec.X * x, vec.Y * x, vec.Z * x, vec.W * x ) ;
|
||||
}
|
||||
|
||||
public static Vec4D operator /(Vec4D vec, float x)
|
||||
public static vec4d operator /( vec4d vec, float x)
|
||||
{
|
||||
return new Vec4D(vec.X / x, vec.Y / x, vec.Z / x, vec.W / x);
|
||||
return new vec4d(vec.X / x, vec.Y / x, vec.Z / x, vec.W / x);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,30 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class ContainerNode<T> where T : INode
|
||||
public interface INode<T> where T : INode<T>
|
||||
{
|
||||
internal readonly T _this;
|
||||
internal ContainerNode<T> ID { get; }
|
||||
|
||||
internal void setID<T>(ContainerNode<T> id) where T : INode<T>;
|
||||
}
|
||||
|
||||
|
||||
public class ContainerNode<T> where T : INode<T>
|
||||
{
|
||||
internal readonly T _value;
|
||||
internal ContainerNode<T> _previous;
|
||||
internal ContainerNode<T> _next;
|
||||
internal ContainerNode<T> _side;
|
||||
|
||||
|
||||
public ContainerNode(T t)
|
||||
{
|
||||
_value = t;
|
||||
t.setID<T>(this);
|
||||
}
|
||||
|
||||
public virtual ContainerNode<T> Previous
|
||||
{
|
||||
@@ -33,13 +46,8 @@ namespace StgSharp
|
||||
|
||||
public T Value
|
||||
{
|
||||
get { return _this; }
|
||||
get { return _value; }
|
||||
}
|
||||
|
||||
public ContainerNode(T t)
|
||||
{
|
||||
_this = t;
|
||||
t.setID<T>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public interface INode
|
||||
{
|
||||
internal ContainerNode<INode> ID { get; }
|
||||
|
||||
internal void setID<T>(ContainerNode<T> id) where T:INode;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,37 @@
|
||||
using System;
|
||||
using StgSharp.Logic;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class LinkedList<T> where T: INode
|
||||
public class LinkedList<T>:IEnumerable where T: INode
|
||||
{
|
||||
internal readonly ContainerNode<T> _heading;
|
||||
internal ContainerNode<T> _first;
|
||||
internal ContainerNode<T> _tail;
|
||||
|
||||
private ContainerNode<T> _cache;
|
||||
|
||||
public LinkedList()
|
||||
{
|
||||
_heading = new ContainerNode<T>(default(T));
|
||||
}
|
||||
|
||||
public T First
|
||||
{
|
||||
get { return _first._this; }
|
||||
set { _first = new ContainerNode<T>(value); }
|
||||
get { return _first._value; }
|
||||
set
|
||||
{
|
||||
_first = new ContainerNode<T>(value);
|
||||
_heading._next = _first;
|
||||
}
|
||||
}
|
||||
|
||||
public T Tail
|
||||
{
|
||||
get { return _tail._this; }
|
||||
get { return _tail._value; }
|
||||
set { _tail = new ContainerNode<T>(value); }
|
||||
}
|
||||
|
||||
@@ -53,8 +65,9 @@ namespace StgSharp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return new LinkedListEnumrator<T>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Logic
|
||||
{
|
||||
internal class LinkedListEnumrator<T> : IEnumerator where T : INode
|
||||
{
|
||||
private LinkedList<T> _target;
|
||||
ContainerNode<T> enumrator;
|
||||
|
||||
public LinkedListEnumrator(LinkedList<T> target)
|
||||
{
|
||||
_target = target;
|
||||
enumrator = target._heading;
|
||||
}
|
||||
|
||||
object IEnumerator.Current
|
||||
{
|
||||
get { return enumrator._value; }
|
||||
}
|
||||
|
||||
bool IEnumerator.MoveNext()
|
||||
{
|
||||
enumrator = enumrator._next;
|
||||
return enumrator == default(ContainerNode<T>);
|
||||
}
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
enumrator = _target._heading;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,18 +10,19 @@ namespace StgSharp
|
||||
{
|
||||
public LinkedList<Point> pointContainer;
|
||||
public LinkedList<IGeometry> geometryContainer;
|
||||
public LinkedList<Sensor> sensorContainer;
|
||||
public LinkedList<Sensor<INode>> sensorContainer;
|
||||
|
||||
public Line leftBoader;
|
||||
public Line rightBoader;
|
||||
public Line topBoader;
|
||||
public Line bottomBoader;
|
||||
|
||||
public Pool()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnRender()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,28 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Sensor : INode
|
||||
{
|
||||
private ContainerNode<INode> _id;
|
||||
|
||||
ContainerNode<INode> INode.ID
|
||||
public delegate bool SensorRuleHandler(IGeometry target, IGeometry boarder);
|
||||
|
||||
public class Sensor<T>
|
||||
{
|
||||
internal IGeometry _boarder;
|
||||
internal IGeometry _target;
|
||||
internal SensorRuleHandler _rule;
|
||||
|
||||
|
||||
public IGeometry boarder
|
||||
{
|
||||
get { return _id; }
|
||||
get { return _boarder; }
|
||||
}
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
public IGeometry target
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
_id = id as ContainerNode<INode>;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentNullException("Cannot set id teice!");
|
||||
}
|
||||
get { return _target; }
|
||||
set { _target = value; }
|
||||
}
|
||||
|
||||
public SensorRuleHandler Rule
|
||||
{
|
||||
get { return _rule; }
|
||||
set { _rule = value; }
|
||||
}
|
||||
|
||||
public static Sensor<T> operator +(Sensor<T> sensor, SensorRuleHandler rule)
|
||||
{
|
||||
sensor._rule += rule;
|
||||
return sensor;
|
||||
}
|
||||
|
||||
public static Sensor<T> operator -(Sensor<T> sensor, SensorRuleHandler rule)
|
||||
{
|
||||
sensor._rule -= rule;
|
||||
return sensor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public class Function
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Optimization
|
||||
{
|
||||
public unsafe class SSE
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Optimization
|
||||
{
|
||||
public static unsafe class x86
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
3a9e429a025cbd1bcea4abf9fbdb2cf05dc117a7
|
||||
3e1ad1a00461e4ab0c00b4070b9447d36b0fd3cb
|
||||
|
||||
Reference in New Issue
Block a user