daily update on 20230301 by nitload youmu, file struct cahnged and more vec func added
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using GLFWDotNet;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
public static class Add
|
||||
{
|
||||
public static void Point(IGeometry geometry)
|
||||
{
|
||||
Point p = new Point();
|
||||
p.getXHandler += geometry.SetArrayX;
|
||||
p.getXHandler += geometry.SetArrayY;
|
||||
TimeLine._cache.pointContainer.Add(p);
|
||||
}
|
||||
|
||||
public static void Line(Point p, float vecX,float vecY)
|
||||
{
|
||||
Line l = new Line(p, vecX, vecY);
|
||||
TimeLine._cache.geometryContainer.Add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
|
||||
public static class Change
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
public static class Remove
|
||||
{
|
||||
public static void Point(Point p)
|
||||
{
|
||||
StgSharp.ContainerNode<INode> _cache = p._id;
|
||||
_cache.Previous.Next = _cache.Next;
|
||||
_cache.Next.Previous = _cache.Previous;
|
||||
_cache.Next = default(StgSharp.ContainerNode<INode>);
|
||||
_cache.Previous = default(StgSharp.ContainerNode<INode>);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Control
|
||||
{
|
||||
public static class TimeLine
|
||||
{
|
||||
public static Pool _cache;
|
||||
|
||||
public static Counter<uint> tickCounter
|
||||
= new Counter<uint>(0,1,1);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Launcher
|
||||
{
|
||||
internal Partical _bullet;
|
||||
|
||||
public Partical Bullet
|
||||
{
|
||||
get { return _bullet; }
|
||||
set { _bullet = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Partical : IEntity
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Player : IEntity
|
||||
{
|
||||
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!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Circle : IGeometry
|
||||
{
|
||||
private StgSharp.ContainerNode<INode> _id;
|
||||
internal Point _referencePoint;
|
||||
internal float _vecX;
|
||||
internal float _vecY;
|
||||
|
||||
public Point ReferencePoint
|
||||
{
|
||||
get { return _referencePoint; }
|
||||
}
|
||||
|
||||
float IGeometry.ExpressionX => throw new NotImplementedException();
|
||||
|
||||
float IGeometry.ExpressionY => throw new NotImplementedException();
|
||||
|
||||
ContainerNode<INode> INode.ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
public float SetArrayX(Counter<uint> tickCounter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public float SetArrayY(Counter<uint> tickCounter)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
if (_id == default(ContainerNode<INode>))
|
||||
{
|
||||
_id = id as ContainerNode<INode>;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public delegate float ExpressionHandler
|
||||
(
|
||||
Counter<uint> tickCounter,
|
||||
float beginRange,
|
||||
float endRange
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using StgSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public delegate float GetLocationHandler(Counter<uint> tickCounter);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using StgSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
|
||||
public interface IGeometry:INode
|
||||
{
|
||||
public Point ReferencePoint
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
internal float ExpressionX
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
internal float ExpressionY
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public float SetArrayX(Counter<uint> tickCounter);
|
||||
public float SetArrayY(Counter<uint> tickCounter);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using StgSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Line:IGeometry
|
||||
{
|
||||
private ContainerNode<INode> _id;
|
||||
|
||||
internal Point _referencePoint;
|
||||
internal float _vecX;
|
||||
internal float _vecY;
|
||||
|
||||
public Point ReferencePoint
|
||||
{
|
||||
get { return _referencePoint; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
ContainerNode<INode> INode.ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
float IGeometry.ExpressionX => throw new NotImplementedException();
|
||||
|
||||
float IGeometry.ExpressionY => throw new NotImplementedException();
|
||||
|
||||
public Line( Point referencePoint, float vecX, float vecY)
|
||||
{
|
||||
_referencePoint = referencePoint;
|
||||
_vecX = vecX;
|
||||
_vecY = vecY;
|
||||
}
|
||||
|
||||
public float SetArrayX(Counter<uint> tickCounter)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
public float SetArrayY(Counter<uint> tickCounter)
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
_id = id as ContainerNode<INode>;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentNullException("Cannot set id teice!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using GLFWDotNet;
|
||||
using StgSharp;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Point: INode
|
||||
{
|
||||
internal StgSharp.ContainerNode<INode> _id;
|
||||
|
||||
internal Vec2D _position;
|
||||
|
||||
internal GetLocationHandler getXHandler;
|
||||
internal GetLocationHandler getYHandler;
|
||||
|
||||
ContainerNode<INode> INode.ID
|
||||
{
|
||||
get { return this._id; }
|
||||
}
|
||||
|
||||
public float X
|
||||
{
|
||||
get { return this._position.X; }
|
||||
}
|
||||
|
||||
public float Y
|
||||
{
|
||||
get { return this._position.Y; }
|
||||
}
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
_id = id as ContainerNode<INode>;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Cannot set id twice!");
|
||||
}
|
||||
}
|
||||
|
||||
public void OnRender()
|
||||
{
|
||||
this.getXHandler.Invoke(Control.TimeLine.tickCounter);
|
||||
this.getYHandler.Invoke(Control.TimeLine.tickCounter);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using StgSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Triangle
|
||||
{
|
||||
internal ContainerNode<INode> _id;
|
||||
|
||||
internal Point _referencePoint;
|
||||
|
||||
internal GetLocationHandler _setArrayXHandler;
|
||||
internal GetLocationHandler _setArrayYHandler;
|
||||
|
||||
public Point ReferencePoint
|
||||
{
|
||||
get { return _referencePoint; }
|
||||
}
|
||||
|
||||
public float VecX
|
||||
{
|
||||
get { return _referencePoint.X; }
|
||||
}
|
||||
|
||||
public float VecY
|
||||
{
|
||||
get { return _referencePoint.Y; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public float SetArrayX(Counter<uint> tickCounter)
|
||||
{
|
||||
return _setArrayXHandler.Invoke(tickCounter);
|
||||
}
|
||||
|
||||
public float SetArrayY(Counter<uint> tickCounter)
|
||||
{
|
||||
return _setArrayYHandler.Invoke(tickCounter);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class ContainerNode<T> where T : INode
|
||||
{
|
||||
internal readonly T _this;
|
||||
internal ContainerNode<T> _previous;
|
||||
internal ContainerNode<T> _next;
|
||||
internal ContainerNode<T> _side;
|
||||
|
||||
|
||||
|
||||
public virtual ContainerNode<T> Previous
|
||||
{
|
||||
get { return _previous; }
|
||||
set { _previous = value; }
|
||||
}
|
||||
|
||||
public ContainerNode<T> Next
|
||||
{
|
||||
get { return _next; }
|
||||
set { _next = value; }
|
||||
}
|
||||
|
||||
public ContainerNode<T> Side
|
||||
{
|
||||
get { return _side; }
|
||||
set { _side = value; }
|
||||
}
|
||||
|
||||
public T Value
|
||||
{
|
||||
get { return _this; }
|
||||
}
|
||||
|
||||
public ContainerNode(T t)
|
||||
{
|
||||
_this = t;
|
||||
t.setID<T>(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
using Microsoft.CSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Counter<T>where T:struct, IConvertible, IFormattable, IComparable
|
||||
{
|
||||
internal readonly dynamic _defualtValue;
|
||||
internal readonly dynamic _defualtAddValue;
|
||||
internal readonly dynamic _defualtSubValue;
|
||||
|
||||
internal dynamic _value;
|
||||
|
||||
public dynamic Value
|
||||
{
|
||||
get { return _value; }
|
||||
set { _value = value; }
|
||||
}
|
||||
|
||||
public Counter(T defualtValue,T defualtAddValue,T defualtSubValue)
|
||||
{
|
||||
var type = Type.GetTypeCode(defualtValue.GetType());
|
||||
switch (type)
|
||||
{
|
||||
case TypeCode.Byte:
|
||||
break;
|
||||
case TypeCode.Int16:
|
||||
break;
|
||||
case TypeCode.Int32:
|
||||
break;
|
||||
case TypeCode.Int64:
|
||||
break;
|
||||
case TypeCode.Double:
|
||||
break;
|
||||
case TypeCode.Single:
|
||||
break;
|
||||
case TypeCode.SByte:
|
||||
break;
|
||||
case TypeCode.UInt16:
|
||||
break;
|
||||
case TypeCode.UInt32:
|
||||
break;
|
||||
case TypeCode.UInt64:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Input is not number value type");
|
||||
break;
|
||||
}
|
||||
_defualtValue = defualtValue;
|
||||
_defualtAddValue = defualtAddValue;
|
||||
_defualtSubValue = defualtSubValue;
|
||||
}
|
||||
|
||||
|
||||
public void Add(T value)
|
||||
{
|
||||
_value += value;
|
||||
}
|
||||
|
||||
public void QuickAdd()
|
||||
{
|
||||
_value += _defualtAddValue;
|
||||
}
|
||||
|
||||
public void Sub(T value)
|
||||
{
|
||||
_value -= value;
|
||||
}
|
||||
|
||||
public void QuickSub()
|
||||
{
|
||||
_value -= _defualtSubValue;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_value = _defualtValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Dictionary<T> where T : Enum ,INode
|
||||
{
|
||||
internal ContainerNode<T> _indexHead;
|
||||
internal ContainerNode<T> _indexTail;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class LinkedList<T> where T: INode
|
||||
{
|
||||
internal ContainerNode<T> _first;
|
||||
internal ContainerNode<T> _tail;
|
||||
|
||||
private ContainerNode<T> _cache;
|
||||
|
||||
public T First
|
||||
{
|
||||
get { return _first._this; }
|
||||
set { _first = new ContainerNode<T>(value); }
|
||||
}
|
||||
|
||||
public T Tail
|
||||
{
|
||||
get { return _tail._this; }
|
||||
set { _tail = new ContainerNode<T>(value); }
|
||||
}
|
||||
|
||||
|
||||
public void Add(T t)
|
||||
{
|
||||
if (_first != default(ContainerNode<T>))
|
||||
{
|
||||
First = t;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cache = new ContainerNode<T>(t);
|
||||
_tail._next = _cache;
|
||||
_cache._previous = _tail;
|
||||
_tail = _cache;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveTail()
|
||||
{
|
||||
if (_tail==default(ContainerNode<T>))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
_cache = _tail;
|
||||
_tail = _cache._previous;
|
||||
_cache._previous = default(ContainerNode<T>);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using StgSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Pool
|
||||
{
|
||||
public LinkedList<Point> pointContainer;
|
||||
public LinkedList<IGeometry> geometryContainer;
|
||||
public LinkedList<Sensor> sensorContainer;
|
||||
|
||||
public Line leftBoader;
|
||||
public Line rightBoader;
|
||||
public Line topBoader;
|
||||
public Line bottomBoader;
|
||||
|
||||
|
||||
public void OnRender()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Sensor : INode
|
||||
{
|
||||
private ContainerNode<INode> _id;
|
||||
|
||||
ContainerNode<INode> INode.ID
|
||||
{
|
||||
get { return _id; }
|
||||
}
|
||||
|
||||
void INode.setID<T>(ContainerNode<T> id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
_id = id as ContainerNode<INode>;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentNullException("Cannot set id teice!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
|
||||
|
||||
public static unsafe float ACos(float x)
|
||||
{
|
||||
|
||||
int sign = 1;
|
||||
float y;
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
sign = -1;
|
||||
y = -x;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = x;
|
||||
}
|
||||
|
||||
if (x > 1)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
float r, s, u, v = 0.0f;
|
||||
bool transform = (y >= 0.5f);
|
||||
|
||||
if (transform)
|
||||
{
|
||||
r = 0.5f * (1.0f - y);
|
||||
s = Calc.Sqrt(r);
|
||||
y = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = y * y;
|
||||
}
|
||||
u = r * (0.184161606965100694821398249421F +
|
||||
(-0.0565298683201845211985026327361F +
|
||||
(-0.0133819288943925804214011424456F -
|
||||
0.00396137437848476485201154797087F * r) * r) * r) /
|
||||
(1.10496961524520294485512696706F -
|
||||
0.836411276854206731913362287293F * r);
|
||||
/**/
|
||||
|
||||
if (transform)
|
||||
{
|
||||
float c, s1, p, q;
|
||||
uint us;
|
||||
|
||||
us = *(uint*)&s;
|
||||
uint uss = us & 0xffff0000;
|
||||
s1 = *(float*)&uss;
|
||||
|
||||
c = (r - s1 * s1) / (s + s1);
|
||||
p = 2.0F * s * u - (piby2_tail - 2.0F * c);
|
||||
q = hpiby2_head - 2.0F * s1;
|
||||
v = hpiby2_head - (p - q);
|
||||
}
|
||||
else
|
||||
{
|
||||
v = y + y * u;
|
||||
}/**/
|
||||
|
||||
v = sign * v ;
|
||||
|
||||
return piby2 - v;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
//
|
||||
// some of the code is rewritten from the AMD code:
|
||||
// https://github.com/amd/aocl-libm-ose/blob/a43e092b03213eb0e129a1cc129900e6e4475778/src/ref/asinf.c
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
|
||||
private const float
|
||||
piby2_tail = 7.5497894159e-08f, /* 0x33a22168 */
|
||||
hpiby2_head = 7.8539812565e-01f, /* 0x3f490fda */
|
||||
piby2 = 1.5707963705e+00f; /* 0x3fc90fdb */
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reurns the value of ArcSin(x)
|
||||
/// </summary>
|
||||
/// <param name="x">The sine value of the angle</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentException"></exception>
|
||||
public static float ASin(float x )
|
||||
{
|
||||
|
||||
int sign = 1;
|
||||
float y ;
|
||||
|
||||
if (x<0)
|
||||
{
|
||||
sign = -1;
|
||||
y = -x;
|
||||
}
|
||||
else
|
||||
{
|
||||
y = x;
|
||||
}
|
||||
|
||||
if ( x>1)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
float r, s, u, v = 0.0f;
|
||||
bool transform = (y >= 0.5f);
|
||||
|
||||
if (transform)
|
||||
{
|
||||
r = 0.5f * (1.0f - y);
|
||||
s = Calc.Sqrt(r);
|
||||
y = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = y * y;
|
||||
}
|
||||
u= r * (0.184161606965100694821398249421F +
|
||||
(-0.0565298683201845211985026327361F +
|
||||
(-0.0133819288943925804214011424456F -
|
||||
0.00396137437848476485201154797087F * r) * r) * r) /
|
||||
(1.10496961524520294485512696706F -
|
||||
0.836411276854206731913362287293F * r);
|
||||
/**/
|
||||
|
||||
if (transform)
|
||||
{
|
||||
float c, s1, p, q;
|
||||
uint us;
|
||||
|
||||
us = *(uint*)&s;
|
||||
uint uss = us & 0xffff0000;
|
||||
s1 = *(float*)&uss;
|
||||
|
||||
c = (r - s1 * s1) / (s + s1);
|
||||
p = 2.0F * s * u - (piby2_tail - 2.0F * c);
|
||||
q = hpiby2_head - 2.0F * s1;
|
||||
v = hpiby2_head - (p - q);
|
||||
}
|
||||
else
|
||||
{
|
||||
v = y + y * u;
|
||||
}/**/
|
||||
|
||||
return sign * v;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
public static unsafe float ATan(float x)
|
||||
{
|
||||
float sign = 1, angle = 0;
|
||||
if (x < 0)
|
||||
{
|
||||
sign = -1;
|
||||
x = -x;
|
||||
}
|
||||
uint xBit = *(uint*)&x;
|
||||
int xExp = (int)(xBit >> 23) - 127;
|
||||
if (xExp >= 26)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (xExp <= -15)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
if (xExp >= 0)
|
||||
{
|
||||
x = (x - 1) / (x + 1);
|
||||
angle = 0.7853981634f;
|
||||
}
|
||||
|
||||
float v = 0.7853981634f * x + x * (1 - x) * (0.2447f+0.0663f * x);
|
||||
v += angle;
|
||||
v *= sign;
|
||||
|
||||
return v;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static unsafe float ATan(float x, float y)
|
||||
{
|
||||
|
||||
|
||||
float z = y / x;
|
||||
|
||||
float sign = 1, angle = 0,angle2 = 0;
|
||||
if (x<0)
|
||||
{
|
||||
angle = -3.1415926535f ;
|
||||
}
|
||||
if (z < 0)
|
||||
{
|
||||
sign = -1;
|
||||
z = -z;
|
||||
}
|
||||
uint zBit = *(uint*)&z;
|
||||
int zExp = (int)(zBit >> 23) - 127;
|
||||
if (zExp >= 26)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (zExp <= -15)
|
||||
{
|
||||
return z;
|
||||
}
|
||||
if (zExp >= 0)
|
||||
{
|
||||
z = (z - 1) / (z + 1);
|
||||
angle2 = 0.7853981634f;
|
||||
}
|
||||
|
||||
float v = 0.7853981634f * z + z * (1 - z) * (0.2447f + 0.0663f * z);
|
||||
v *= 57.29577951f;
|
||||
v += angle2;
|
||||
v += angle;
|
||||
v *= sign;
|
||||
|
||||
return v;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Numerics;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
|
||||
public static float Cos(float x)
|
||||
{
|
||||
float refer = x / 360.0f;
|
||||
refer -= (int)refer;
|
||||
|
||||
refer *= 40;
|
||||
int a = (int)refer; //大分度,查表
|
||||
refer -= a; //小分度,拟合
|
||||
|
||||
float refer2 = refer * refer;
|
||||
|
||||
|
||||
return -sinData[a] * (0.1570796327f * refer - 6.459640975e-4f * refer * refer2)
|
||||
+ cosData[a] * (1 - 0.0123370055f * refer2 + 2.536695709e-5f * refer2 * refer2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
|
||||
public const float E = 2.718281828f;
|
||||
/// <summary>
|
||||
/// Get the value of E ^ x;
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <returns></returns>
|
||||
public static unsafe float Exp(float x)
|
||||
{
|
||||
if (x == 1)
|
||||
{
|
||||
return E;
|
||||
}
|
||||
if (x == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool sign = false;
|
||||
if (x<0)
|
||||
{
|
||||
sign = true;
|
||||
x = -x;
|
||||
}
|
||||
|
||||
float z = x , t;
|
||||
if (x<0.5f)
|
||||
{
|
||||
t = 1.0f + x * (
|
||||
1.0f + x * (
|
||||
0.5f + x * (
|
||||
0.1666666667f + x * (
|
||||
0.0416666666667f + x *
|
||||
8.333333333e-3f))));
|
||||
}
|
||||
else
|
||||
{
|
||||
uint zBit = *(uint*)&z;
|
||||
uint zBitAbs = zBit & 0b_0111_1111_1111_1111_1111_1111_1111_1111;
|
||||
uint uintm = (zBitAbs >> 23);
|
||||
int m = (*(int*)&uintm) - 126;
|
||||
|
||||
|
||||
uint nBit = (zBitAbs & 0b_0000_0000_0111_1111_1111_1111_1111_1111)
|
||||
+ 0b_0011_1111_0000_0000_0000_0000_0000_0000;
|
||||
float n = *(float*)&nBit - 1;
|
||||
|
||||
t = 2.718281828f + n * (
|
||||
2.718281828f + n * (
|
||||
1.359140914f + n * (
|
||||
0.4530469714f + n * (
|
||||
0.1132617429f + n *
|
||||
0.02265234857f))));
|
||||
|
||||
for (int i = 0; i < m; i++)
|
||||
{
|
||||
t = t * t;
|
||||
}
|
||||
}
|
||||
|
||||
if (sign)
|
||||
{
|
||||
t = 1 / t;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Get the bits of a float number
|
||||
/// </summary>
|
||||
/// <param name="x">The given float number</param>
|
||||
/// <returns></returns>
|
||||
public static uint GetBits32(float x)
|
||||
{
|
||||
Union4 union = new Union4();
|
||||
union.f = x;
|
||||
return union.i;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
|
||||
static private readonly float[] logArray =
|
||||
{
|
||||
0f, 0.00995033085316809f, 0.0198026272961797f, 0.0295588022415444f, 0.0392207131532813f, 0.048790164169432f, 0.0582689081239758f, 0.0676586484738149f, 0.0769610411361284f, 0.0861776962410524f,
|
||||
0.0953101798043249f, 0.104360015324243f, 0.113328685307003f, 0.122217632724249f, 0.131028262406404f, 0.139761942375159f, 0.148420005118273f, 0.157003748809665f, 0.165514438477573f, 0.173953307123438f,
|
||||
0.182321556793955f, 0.19062035960865f, 0.198850858745165f, 0.207014169384326f, 0.215111379616945f, 0.22314355131421f, 0.231111720963387f, 0.2390169004705f, 0.246860077931526f, 0.254642218373581f,
|
||||
0.262364264467491f, 0.27002713721306f, 0.27763173659828f, 0.285178942233662f, 0.29266961396282f, 0.300104592450338f, 0.307484699747961f, 0.314810739840034f, 0.322083499169113f, 0.3293037471426f,
|
||||
0.336472236621213f, 0.343589704390077f, 0.350656871613169f, 0.357674444271816f, 0.364643113587909f, 0.371563556432483f, 0.378436435720245f, 0.385262400790645f, 0.392042087776024f, 0.398776119957368f,
|
||||
0.405465108108164f, 0.412109650826833f, 0.418710334858185f, 0.425267735404344f, 0.431782416425538f, 0.438254930931155f, 0.444685821261446f, 0.451075619360217f, 0.457424847038875f, 0.46373401623214f,
|
||||
0.470003629245736f, 0.476234178996372f, 0.482426149244293f, 0.488580014818671f, 0.494696241836107f, 0.500775287912489f, 0.506817602368452f, 0.512823626428664f, 0.518793793415168f, 0.524728528934982f,
|
||||
0.53062825106217f, 0.536493370514568f, 0.542324290825362f, 0.548121408509688f, 0.553885113226438f, 0.559615787935423f, 0.56531380905006f, 0.570979546585738f, 0.576613364303994f, 0.582215619852664f,
|
||||
0.587786664902119f, 0.593326845277734f, 0.598836501088704f, 0.60431596685333f, 0.609765571620894f, 0.615185639090233f, 0.62057648772511f, 0.625938430866495f, 0.631271776841858f, 0.636576829071551f,
|
||||
0.641853886172395f, 0.647103242058538f, 0.65232518603969f, 0.657520002916794f, 0.662687973075237f, 0.667829372575655f, 0.672944473242426f, 0.678033542749897f, 0.683096844706444f, 0.688134638736401f,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <returns>
|
||||
/// Returns the value of ln(x).
|
||||
/// </returns>
|
||||
public unsafe static float Log(float x)
|
||||
{
|
||||
if (x<0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
uint input = *(uint*)&x;
|
||||
|
||||
uint f = input;
|
||||
f >>= 23;
|
||||
f -= 127;
|
||||
input <<= 9;
|
||||
input >>= 9;
|
||||
input += 0b_0011_1111_1000_0000_0000_0000_0000_0000;
|
||||
float result = *(float*)&input;
|
||||
int order = (int)(result * 100)-100;
|
||||
|
||||
float cache = (result) / (1f + 0.01f * order) -1 ;
|
||||
result = cache * -0.25f + 0.3333333333333f;
|
||||
result = result * cache - 0.5f;
|
||||
result = result * cache + 1.0f;
|
||||
result *= cache;
|
||||
|
||||
return
|
||||
f*0.6931471806f +
|
||||
result +
|
||||
logArray[order];
|
||||
}
|
||||
|
||||
|
||||
public static float Log(float x, float y)
|
||||
{
|
||||
return Log(x)/Log(y);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Calc
|
||||
{
|
||||
/// <summary>
|
||||
/// calculate the value of x^y
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns>Returns the value of x^y</returns>
|
||||
public static unsafe float Pow(float x, float y)
|
||||
{
|
||||
/*
|
||||
* x^y = E ^ ( log( x ) * y )
|
||||
* Now define z = | log(x) * y | = m * n
|
||||
* and m is an integer, and 0.5 < |n| < 1
|
||||
* then E ^ z = ( E ^ n ) ^ m
|
||||
*
|
||||
*
|
||||
* As a float number can be expressed in (1+e)*(2^f)
|
||||
* n = (1+e)/2
|
||||
* m = 2 ^ (f + 1)
|
||||
*
|
||||
*/
|
||||
float z, t;
|
||||
if (x == 1 || y == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (x==1&&y==0)
|
||||
{
|
||||
return 1.0f / 0;
|
||||
}
|
||||
z = Calc.Log(x) * y;
|
||||
|
||||
bool sign = false;
|
||||
if (z < 0)
|
||||
{
|
||||
sign = true;
|
||||
z = -z;
|
||||
}
|
||||
|
||||
if (z<0.5f)
|
||||
{
|
||||
t = 1.0f + z * (
|
||||
1.0f + z * (
|
||||
0.5f + z * (
|
||||
0.1666666667f + z * (
|
||||
0.0416666666667f + z *
|
||||
8.333333333e-3f))));
|
||||
}
|
||||
else
|
||||
{
|
||||
uint zBit = *(uint*)&z;
|
||||
uint zBitAbs = zBit & 0b_0111_1111_1111_1111_1111_1111_1111_1111;
|
||||
uint uintm = (zBitAbs >> 23);
|
||||
int m = (*(int*)&uintm) - 126;
|
||||
|
||||
|
||||
uint nBit = (zBitAbs & 0b_0000_0000_0111_1111_1111_1111_1111_1111)
|
||||
+ 0b_0011_1111_0000_0000_0000_0000_0000_0000;
|
||||
float n = *(float*)&nBit - 1;
|
||||
|
||||
t = 2.718281828f + n * (
|
||||
2.718281828f + n * (
|
||||
1.359140914f + n * (
|
||||
0.4530469714f + n * (
|
||||
0.1132617429f + n *
|
||||
0.02265234857f))));
|
||||
|
||||
for (int i = 0; i < m; i++)
|
||||
{
|
||||
t = t * t;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (sign)
|
||||
{
|
||||
t = 1 / t;
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
private static readonly float[] sinData =
|
||||
{
|
||||
0f, 0.15643446239373f, 0.309016989278255f, 0.453990492577218f, 0.587785243621462f,
|
||||
0.707106771713121f, 0.80901698492516f, 0.891006515673128f, 0.951056509671091f, 0.987688336822657f,
|
||||
1f, 0.987688345205947f, 0.951056526231247f, 0.891006540002384f, 0.80901701642445f,
|
||||
0.707106809606826f, 0.587785286976515f, 0.453990540326073f, 0.309017040245177f, 0.156434515323744f,
|
||||
5.35897931701074E-08f, -0.156434409463716f, -0.309016938311333f, -0.453990444828362f, -0.587785200266408f,
|
||||
-0.707106733819413f, -0.809016953425868f, -0.891006491343869f, -0.951056493110931f, -0.987688328439363f,
|
||||
-0.999999999999997f, -0.987688353589235f, -0.951056542791401f, -0.891006564331638f, -0.809017047923737f,
|
||||
-0.70710684750053f, -0.587785330331566f, -0.453990588074927f, -0.309017091212098f, -0.156434568253757f,
|
||||
|
||||
|
||||
};
|
||||
private static readonly float[] cosData =
|
||||
{
|
||||
1f, 0.987688341014302f, 0.951056517951169f, 0.891006527837756f, 0.809017000674805f,
|
||||
0.707106790659974f, 0.587785265298989f, 0.453990516451646f, 0.309017014761716f, 0.156434488858737f,
|
||||
2.67948965850537E-08f, -0.156434435928723f, -0.309016963794794f, -0.453990468702791f, -0.587785221943935f,
|
||||
-0.707106752766267f, -0.809016969175515f, -0.891006503508499f, -0.951056501391011f, -0.98768833263101f,
|
||||
-0.999999999999999f, -0.987688349397591f, -0.951056534511324f, -0.891006552167012f, -0.809017032174094f,
|
||||
-0.707106828553679f, -0.587785308654041f, -0.4539905642005f, -0.309017065728638f, -0.156434541788751f,
|
||||
-8.03846893110719E-08f, 0.156434382998709f, 0.309016912827872f, 0.453990420953934f, 0.58778517858888f,
|
||||
0.707106714872559f, 0.809016937676222f, 0.891006479179238f, 0.951056484830851f, 0.987688324247716f,
|
||||
|
||||
|
||||
};
|
||||
|
||||
public static unsafe float Sin(float x)
|
||||
{
|
||||
float refer = x / 360.0f;
|
||||
refer -= (int)refer;
|
||||
|
||||
refer *= 40;
|
||||
int a = (int)refer; //大分度,查表
|
||||
refer -= a; //小分度,拟合
|
||||
|
||||
float refer2 = refer * refer;
|
||||
|
||||
|
||||
return sinData[a]*(1 - 0.0123370055f * refer2 + 2.536695709e-5f * refer2 * refer2 )
|
||||
+ cosData[a] * (0.1570796327f * refer - 6.459640975e-4f * refer * refer2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
/*本方法将小数部分统一提升至2^16处后进行线性近似
|
||||
const uint sqmov = 0b_0100_0111_1000_0000_0000_0000_0000_0000;
|
||||
const float sqmov1 = 0.0015947f;
|
||||
const float sqmov2 = 156.7673435f;
|
||||
const float sqmov3 = 261.2776027f;
|
||||
/**/
|
||||
public static unsafe float Sqrt(float x)
|
||||
{
|
||||
/*
|
||||
* 本方法采用分别对指数和小数处理的方法计算平方根
|
||||
* 将指数除以2即可获得结果的指数
|
||||
* (补充:指数最低位被加到小数位中以抵消一个多余的2 ^ 1的影响)
|
||||
* 小数部分则统一乘以2 ^ 16后由y = Sqrt(x)在1.5 * 2 ^ 16处的切线近似
|
||||
* 为简化操作,提高计算速度,切线左界被移动到远点
|
||||
* 在进一步简化操作后,计算精度达到0.5%,速度约为.Net库函数的1.8倍
|
||||
*/
|
||||
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (x == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
* 提取指数位并减去指数位中的127
|
||||
* 由于平方根仅对正数有效
|
||||
* 故不考虑正负号
|
||||
*/
|
||||
uint a = *(uint*)&x;
|
||||
uint f = a;
|
||||
f >>= 23;
|
||||
f /= 2;
|
||||
f += 64;
|
||||
|
||||
/*
|
||||
* 提取小数位
|
||||
* 由于平方根仅对正数有效
|
||||
* 故不考虑正负号
|
||||
*/
|
||||
|
||||
a -= 0b_0011_1111_0000_0000_0000_0000_0000_0000;
|
||||
uint e = a << 8;
|
||||
e >>= 8;
|
||||
|
||||
/*线性近似*/
|
||||
e *= 0b_1101_0001;
|
||||
e >>= 24;
|
||||
e += 0b_0000_0000_0001_0000_1010_1000_1110_0010;
|
||||
|
||||
/*还原指数*/
|
||||
f <<= 23;
|
||||
e += f;
|
||||
|
||||
float result = *(float*)&e;
|
||||
result = (result + x / result) / 2;
|
||||
return (result + x / result) / 2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class Calc
|
||||
{
|
||||
|
||||
public static float Tan(float x)
|
||||
{
|
||||
float refer = x / 360.0f;
|
||||
refer -= (int)refer;
|
||||
|
||||
refer *= 40;
|
||||
int a = (int)refer; //大分度,查表
|
||||
refer -= a; //小分度,拟合
|
||||
|
||||
float refer2 = refer * refer;
|
||||
|
||||
float sin = (0.1570796327f * refer - 6.459640975e-4f * refer * refer2);
|
||||
float cos = (1 - 0.0123370055f * refer2 + 2.536695709e-5f * refer2 * refer2);
|
||||
|
||||
return ( sinData[a] * cos + cosData[a] * sin )
|
||||
/ ( cosData[a] * cos - sinData[a] * sin );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<Optimize>True</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GLFWDotNet" Version="20.9.0" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="Steamworks.NET" Version="20.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Array2x2:IEquatable<Array2x2>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec2D row1;
|
||||
[FieldOffset(8)]
|
||||
public Vec2D row2;
|
||||
|
||||
public Array2x2(Vec2D c0, Vec2D c1)
|
||||
{
|
||||
row1 = c0;
|
||||
row2 = c1;
|
||||
}
|
||||
|
||||
public Array2x2(
|
||||
float a11,
|
||||
float a12,
|
||||
float a21,
|
||||
float a22
|
||||
)
|
||||
{
|
||||
row1 = new Vec2D(a11, a12);
|
||||
row2 = new Vec2D(a21, a22);
|
||||
}
|
||||
|
||||
bool IEquatable<Array2x2>.Equals(Array2x2 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
this.row1 == other.row1
|
||||
&& this.row2 == other.row2;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Array2x2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec3D)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public static unsafe Array2x2 operator *(Array2x2 array1, Array2x2 array2)
|
||||
{
|
||||
float* p = &array1.row1.X;
|
||||
|
||||
Vec2D colum1 = new Vec2D(
|
||||
*p , *(p + 2)
|
||||
);
|
||||
Vec2D colum2 = new Vec2D(
|
||||
*(p + 1), *(p + 3)
|
||||
);
|
||||
|
||||
return new Array2x2(
|
||||
colum1 * array2.row1,
|
||||
colum2 * array2.row1,
|
||||
colum1 * array2.row2,
|
||||
colum2 * array2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Array2x2 operator +(Array2x2 array1, Array2x2 array2)
|
||||
{
|
||||
return new Array2x2(
|
||||
array1.row1 + array2.row1,
|
||||
array1.row2 + array2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Array2x2 operator -(Array2x2 array1, Array2x2 array2)
|
||||
{
|
||||
return new Array2x2(
|
||||
array1.row1 - array2.row1,
|
||||
array1.row2 - array2.row2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Array2x3:IEquatable<Array2x3>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec3D row1;
|
||||
[FieldOffset(12)]
|
||||
public Vec3D row2;
|
||||
|
||||
public Array2x3(Vec3D r1, Vec3D r2)
|
||||
{
|
||||
row1 = r1;
|
||||
row2 = r2;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Array2x3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec3D)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(row1, row2);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{row1}\n{row2}";
|
||||
}
|
||||
|
||||
bool IEquatable<Array2x3>.Equals(Array2x3 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
this.row1 == other.row1
|
||||
&& this.row2 == other.row2;
|
||||
}
|
||||
}
|
||||
|
||||
public static Array2x3 operator +(Array2x3 array1, Array2x3 array2)
|
||||
{
|
||||
return new Array2x3(
|
||||
array1.row1 + array2.row1,
|
||||
array1.row2 + array2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Array2x3 operator -(Array2x3 array1, Array2x3 array2)
|
||||
{
|
||||
return new Array2x3(
|
||||
array1.row1 - array2.row1,
|
||||
array1.row2 - array2.row2
|
||||
);
|
||||
}
|
||||
|
||||
public static Array2x3 operator *(Array2x3 array, float x)
|
||||
{
|
||||
return new Array2x3(
|
||||
array.row1 * x,
|
||||
array.row2 * x
|
||||
) ;
|
||||
}
|
||||
|
||||
public static Array2x3 operator /(Array2x3 array, float x)
|
||||
{
|
||||
return new Array2x3(
|
||||
array.row1 / x,
|
||||
array.row2 / x
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Array2x2 operator *(Array2x3 array1, Array3x2 array2)
|
||||
{
|
||||
float* p1 = &array1.row1.X;
|
||||
float* p2 = &array2.row2.X;
|
||||
|
||||
return new Array2x2(
|
||||
*(p1 + 0) * *(p2 + 0) + *(p1 + 1) * *(p2 + 2) + *(p1 + 2) * *(p2 + 4),
|
||||
*(p1 + 0) * *(p2 + 1) + *(p1 + 1) * *(p2 + 3) + *(p1 + 2) * *(p2 + 5),
|
||||
*(p1 + 3) * *(p2 + 0) + *(p1 + 4) * *(p2 + 2) + *(p1 + 5) * *(p2 + 4),
|
||||
*(p1 + 3) * *(p2 + 1) + *(p1 + 4) * *(p2 + 3) + *(p1 + 5) * *(p2 + 5)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Array3x2:IEquatable<Array3x2>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec2D row1;
|
||||
[FieldOffset(8)]
|
||||
public Vec2D row2;
|
||||
[FieldOffset(16)]
|
||||
public Vec2D row3;
|
||||
|
||||
public Array3x2(Vec2D r1,Vec2D r2,Vec2D r3)
|
||||
{
|
||||
row1= r1;
|
||||
row2= r2;
|
||||
row3= r3;
|
||||
}
|
||||
bool IEquatable<Array3x2>.Equals(Array3x2 other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
this.row1 == other.row1
|
||||
&& this.row2 == other.row2
|
||||
&& this.row3 == other.row3
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Array3x2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Array3x2)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(row1, row2, row3);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{row1}\n{row2}\n{row3}";
|
||||
}
|
||||
|
||||
public static unsafe Array3x3 operator *(Array3x2 array1, Array2x3 array2)
|
||||
{
|
||||
float* p1 = &array1.row1.X;
|
||||
float* p2 = &array2.row2.X;
|
||||
|
||||
return new Array3x3(
|
||||
*(p1 + 0) * *(p2 + 0) + *(p1 + 1) * *(p2 + 3),
|
||||
*(p1 + 0) * *(p2 + 1) + *(p1 + 1) * *(p2 + 4),
|
||||
*(p1 + 0) * *(p2 + 2) + *(p1 + 1) * *(p2 + 5),
|
||||
*(p1 + 2) * *(p2 + 0) + *(p1 + 3) * *(p2 + 3),
|
||||
*(p1 + 2) * *(p2 + 1) + *(p1 + 3) * *(p2 + 4),
|
||||
*(p1 + 2) * *(p2 + 2) + *(p1 + 3) * *(p2 + 5),
|
||||
*(p1 + 4) * *(p2 + 0) + *(p1 + 5) * *(p2 + 3),
|
||||
*(p1 + 4) * *(p2 + 1) + *(p1 + 5) * *(p2 + 4),
|
||||
*(p1 + 4) * *(p2 + 2) + *(p1 + 5) * *(p2 + 5)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Array3x3:IEquatable<Array3x3>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vec3D row1;
|
||||
[FieldOffset(12)]
|
||||
public Vec3D row2;
|
||||
[FieldOffset(24)]
|
||||
public Vec3D row3;
|
||||
|
||||
public Array3x3(Vec3D r0,Vec3D r1,Vec3D r2)
|
||||
{
|
||||
row1 = r0;
|
||||
row2 = r1;
|
||||
row3 = r2;
|
||||
}
|
||||
|
||||
public Array3x3(
|
||||
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);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(row1,row2,row3);
|
||||
}
|
||||
|
||||
bool IEquatable<Array3x3>.Equals(Array3x3 other)
|
||||
{
|
||||
if (this.GetHashCode()!=other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
this.row1 == other.row1
|
||||
&& this.row2 == other.row2
|
||||
&& this.row3 == other.row3;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Array3x3))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Array3x3)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{row1}\n{row2}\n{row3}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool operator ==(Array3x3 array1, Array3x3 array2)
|
||||
{
|
||||
return array1.Equals(array2);
|
||||
}
|
||||
|
||||
public static bool operator !=(Array3x3 array1, Array3x3 array2)
|
||||
{
|
||||
return !array1.Equals(array2);
|
||||
}
|
||||
|
||||
public static Array3x3 operator +(Array3x3 array1, Array3x3 array2)
|
||||
{
|
||||
return new Array3x3(
|
||||
array1.row1.X + array2.row1.X,
|
||||
array1.row1.Y + array2.row1.Y,
|
||||
array1.row1.Z + array2.row1.Z,
|
||||
|
||||
array1.row2.X + array2.row2.X,
|
||||
array1.row2.Y + array2.row2.Y,
|
||||
array1.row2.Z + array2.row2.Z,
|
||||
|
||||
array1.row3.X + array2.row3.X,
|
||||
array1.row3.Y + array2.row3.Y,
|
||||
array1.row3.Z + array2.row3.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static Array3x3 operator -(Array3x3 array1, Array3x3 array2)
|
||||
{
|
||||
return new Array3x3(
|
||||
array1.row1.X - array2.row1.X,
|
||||
array1.row1.Y - array2.row1.Y,
|
||||
array1.row1.Z - array2.row1.Z,
|
||||
|
||||
array1.row2.X - array2.row2.X,
|
||||
array1.row2.Y - array2.row2.Y,
|
||||
array1.row2.Z - array2.row2.Z,
|
||||
|
||||
array1.row3.X - array2.row3.X,
|
||||
array1.row3.Y - array2.row3.Y,
|
||||
array1.row3.Z - array2.row3.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static unsafe Array3x3 operator *(Array3x3 array1,Array3x3 array2)
|
||||
{
|
||||
float* p1 = &array1.row1.X;
|
||||
float* p2 = &array2.row1.X;
|
||||
return new Array3x3(
|
||||
*(p1 + 0) * *(p2 + 0) + *(p1 + 1) * *(p2 + 3) + *(p1 + 2) * *(p2 + 6),
|
||||
*(p1 + 0) * *(p2 + 1) + *(p1 + 1) * *(p2 + 4) + *(p1 + 2) * *(p2 + 7),
|
||||
*(p1 + 0) * *(p2 + 2) + *(p1 + 1) * *(p2 + 5) + *(p1 + 2) * *(p2 + 8),
|
||||
*(p1 + 3) * *(p2 + 0) + *(p1 + 4) * *(p2 + 3) + *(p1 + 5) * *(p2 + 6),
|
||||
*(p1 + 3) * *(p2 + 1) + *(p1 + 4) * *(p2 + 4) + *(p1 + 5) * *(p2 + 7),
|
||||
*(p1 + 3) * *(p2 + 2) + *(p1 + 4) * *(p2 + 5) + *(p1 + 5) * *(p2 + 8),
|
||||
*(p1 + 6) * *(p2 + 0) + *(p1 + 7) * *(p2 + 3) + *(p1 + 2) * *(p2 + 6),
|
||||
*(p1 + 6) * *(p2 + 1) + *(p1 + 7) * *(p2 + 4) + *(p1 + 2) * *(p2 + 7),
|
||||
*(p1 + 6) * *(p2 + 2) + *(p1 + 7) * *(p2 + 5) + *(p1 + 2) * *(p2 + 8)
|
||||
);
|
||||
}
|
||||
|
||||
public static Array3x3 operator *(Array3x3 array, float x)
|
||||
{
|
||||
return new Array3x3(
|
||||
array.row1 * x,
|
||||
array.row2 * x,
|
||||
array.row3 * x
|
||||
);
|
||||
}
|
||||
|
||||
public static Array3x3 operator /(Array3x3 array, float x)
|
||||
{
|
||||
return new Array3x3(
|
||||
array.row1/x,
|
||||
array.row2/x,
|
||||
array.row3/x
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
{
|
||||
|
||||
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)
|
||||
{
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
{
|
||||
|
||||
public static float Det(Array2x2 array)
|
||||
{
|
||||
return Cross(array.row1,array.row2);
|
||||
}
|
||||
|
||||
public static unsafe float Det(Array3x3 array)
|
||||
{
|
||||
float* p = &array.row1.X;
|
||||
|
||||
Array2x2 array1 = new Array2x2(
|
||||
*(p + 4), *(p + 5),
|
||||
*(p + 7), *(p + 8)
|
||||
);
|
||||
Array2x2 array2 = new Array2x2(
|
||||
*(p + 3), *(p + 5),
|
||||
*(p + 6), *(p + 8)
|
||||
);
|
||||
Array2x2 array3 = new Array2x2(
|
||||
*(p + 3), *(p + 4),
|
||||
*(p + 6), *(p + 7)
|
||||
);
|
||||
|
||||
return
|
||||
*p * Det(array1)
|
||||
- *(p + 1) * Det(array2)
|
||||
+ *(p + 2) * Det(array3)
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
{
|
||||
public static float GetAngle(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return Calc.ACos(
|
||||
vec1 * vec2
|
||||
/ (vec1.GetLength() * vec2.GetLength())
|
||||
);
|
||||
}
|
||||
|
||||
public static float GetAngle(Vec3D vec1, Vec3D vec2)
|
||||
{
|
||||
return Calc.ACos(
|
||||
vec1 * vec2
|
||||
/ (vec1.GetLength() * vec2.GetLength())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
{
|
||||
public static float GetLength(this Vec3D vec)
|
||||
{
|
||||
return Calc.Sqrt(
|
||||
vec.X * vec.X +
|
||||
vec.Y * vec.Y +
|
||||
vec.Z * vec.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static float GetLength(this Vec2D vec)
|
||||
{
|
||||
return Calc.Sqrt(
|
||||
vec.X * vec.X +
|
||||
vec.Y * vec.Y
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Runtime;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Vec2D:IEquatable<Vec2D>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
[FieldOffset(sizeof(float))]
|
||||
public float Y;
|
||||
|
||||
public Vec2D(float x,float y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public bool Equals(Vec2D other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.X == other.X && this.Y == other.Y;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Vec2D))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec2D)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(X, Y);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{this.X}\t{this.Y}";
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return !(vec1.X == vec2.X && vec1.Y == vec2.Y);
|
||||
}
|
||||
|
||||
public static Vec2D operator +(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return new Vec2D(vec1.X + vec2.X, vec1.Y + vec2.Y);
|
||||
}
|
||||
|
||||
public static Vec2D operator -(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return new Vec2D(vec1.X + vec2.X, vec1.Y + vec2.Y);
|
||||
}
|
||||
|
||||
public static float operator *(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return vec1.X * vec2.X + vec1.Y*vec2.Y;
|
||||
}
|
||||
|
||||
public static Vec2D operator *(Vec2D vec, float x)
|
||||
{
|
||||
return new Vec2D(vec.X * x, vec.Y * x);
|
||||
}
|
||||
|
||||
public static Vec2D operator /(Vec2D vec, float x)
|
||||
{
|
||||
return new Vec2D(vec.X/x, vec.Y/x);
|
||||
}
|
||||
|
||||
public Vec3D to3D()
|
||||
{
|
||||
return new Vec3D(this.X, this.Y, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Vec3D : IEquatable<Vec3D>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
[FieldOffset(4)]
|
||||
public float Y;
|
||||
[FieldOffset(8)]
|
||||
public float Z;
|
||||
|
||||
public Vec3D(float x, float y, float z)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
}
|
||||
|
||||
bool IEquatable<Vec3D>.Equals(Vec3D other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.X == other.X
|
||||
&& this.Y == other.Y
|
||||
&& this.Z == other.Z;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (obj.GetType() != typeof(Vec3D))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.Equals((Vec3D)obj);
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(X, Y, Z);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{X}\t{Y}\t{Z}";
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return !(vec1.X == vec2.X
|
||||
&& vec1.Y == vec2.Y
|
||||
&& vec1.Z == vec2.Z);
|
||||
}
|
||||
|
||||
public static Vec3D operator +(Vec3D vec1, Vec3D vec2)
|
||||
{
|
||||
return new Vec3D(
|
||||
vec1.X + vec2.X,
|
||||
vec1.Y + vec2.Y,
|
||||
vec1.Z + vec2.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static Vec3D operator -(Vec3D vec1, Vec3D vec2)
|
||||
{
|
||||
return new Vec3D(
|
||||
vec1.X - vec2.X,
|
||||
vec1.Y - vec2.Y,
|
||||
vec1.Z - vec2.Z
|
||||
);
|
||||
}
|
||||
|
||||
public static float operator *(Vec3D vec1, Vec3D vec2)
|
||||
{
|
||||
return
|
||||
vec1.X * vec2.X
|
||||
+ vec1.Y + vec2.Y
|
||||
+ vec1.Z + vec2.Z;
|
||||
}
|
||||
|
||||
public static Vec3D operator *(Vec3D vec, float x)
|
||||
{
|
||||
return new Vec3D(
|
||||
vec.X * x,
|
||||
vec.Y * x,
|
||||
vec.Z * x
|
||||
);
|
||||
}
|
||||
|
||||
public static Vec3D operator /(Vec3D vec, float x)
|
||||
{
|
||||
return new Vec3D(
|
||||
vec.X / x,
|
||||
vec.Y / x,
|
||||
vec.Z / x
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Vec4D:IEquatable<Vec4D>
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float X;
|
||||
[FieldOffset(4)]
|
||||
public float Y;
|
||||
[FieldOffset(8)]
|
||||
public float Z;
|
||||
[FieldOffset(12)]
|
||||
public float W;
|
||||
|
||||
[FieldOffset(0)]
|
||||
public Vec2D Point1;
|
||||
[FieldOffset(8)]
|
||||
public Vec2D Point2;
|
||||
|
||||
public Vec4D(float x,float y,float z,float w)
|
||||
{
|
||||
Point1 = new Vec2D();
|
||||
Point2 = new Vec2D();
|
||||
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
W = w;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(obj.GetType() != typeof(Vec4D))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return this == (Vec4D)obj;
|
||||
}
|
||||
}
|
||||
|
||||
bool IEquatable<Vec4D>.Equals(Vec4D other)
|
||||
{
|
||||
if (this.GetHashCode() != other.GetHashCode())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
this.Point1 == other.Point1
|
||||
&& this.Point2 == other.Point2;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(X, Y, Z, W);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{X}\t{Y}\t{Y}\t{Y}";
|
||||
}
|
||||
|
||||
public static bool operator ==(Vec4D vec1, Vec4D vec2)
|
||||
{
|
||||
return vec1.Equals(vec2);
|
||||
}
|
||||
|
||||
public static bool operator !=(Vec4D vec1, Vec4D vec2)
|
||||
{
|
||||
return !vec1.Equals(vec2);
|
||||
}
|
||||
|
||||
public static Vec4D operator +(Vec4D vec1, Vec4D vec2)
|
||||
{
|
||||
return new Vec4D(
|
||||
vec1.X + vec2.X,
|
||||
vec1.Y + vec2.Y,
|
||||
vec1.Z + vec2.Z,
|
||||
vec1.W + vec2.W
|
||||
);
|
||||
}
|
||||
|
||||
public static Vec4D operator -(Vec4D vec1, Vec4D vec2)
|
||||
{
|
||||
return new Vec4D(
|
||||
vec1.X - vec2.X,
|
||||
vec1.Y - vec2.Y,
|
||||
vec1.Z - vec2.Z,
|
||||
vec1.W - vec2.W
|
||||
);
|
||||
}
|
||||
|
||||
public static float operator *(Vec4D vec1, Vec4D vec2)
|
||||
{
|
||||
return
|
||||
vec1.X * vec2.X
|
||||
+ vec1.Y * vec2.Y
|
||||
+ vec1.Z * vec2.Z
|
||||
+ vec1.W * vec2.W;
|
||||
}
|
||||
|
||||
public static Vec4D operator *(Vec4D vec, float x)
|
||||
{
|
||||
return new Vec4D(vec.X * x, vec.Y * x, vec.Z * x, vec.W * x ) ;
|
||||
}
|
||||
|
||||
public static Vec4D operator /(Vec4D vec, float x)
|
||||
{
|
||||
return new Vec4D(vec.X / x, vec.Y / x, vec.Z / x, vec.W / x);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETStandard,Version=v2.1/",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETStandard,Version=v2.1": {},
|
||||
".NETStandard,Version=v2.1/": {
|
||||
"StgSharp/1.0.0": {
|
||||
"dependencies": {
|
||||
"GLFWDotNet": "20.9.0",
|
||||
"Microsoft.CSharp": "4.7.0",
|
||||
"Steamworks.NET": "20.1.0"
|
||||
},
|
||||
"runtime": {
|
||||
"StgSharp.dll": {}
|
||||
}
|
||||
},
|
||||
"GLFWDotNet/20.9.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/GLFWDotNet.dll": {
|
||||
"assemblyVersion": "20.9.0.0",
|
||||
"fileVersion": "20.9.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.CSharp.dll": {
|
||||
"assemblyVersion": "4.0.5.0",
|
||||
"fileVersion": "4.700.19.56404"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Steamworks.NET/20.1.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/Steamworks.NET.dll": {
|
||||
"assemblyVersion": "20.1.0.0",
|
||||
"fileVersion": "20.1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"StgSharp/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"GLFWDotNet/20.9.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-fWonCs+BBqeK5R8t0g293RPoqerH27FHNcPyL/Hbxe0Ap4QCNKhQYf2tXJU1XTMf1ZbuLmM1MY5lonV35eGw6Q==",
|
||||
"path": "glfwdotnet/20.9.0",
|
||||
"hashPath": "glfwdotnet.20.9.0.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
|
||||
"path": "microsoft.csharp/4.7.0",
|
||||
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
|
||||
},
|
||||
"Steamworks.NET/20.1.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-+GntwnyJ5tCNvUIaQxv2+ehDvZJzGUqlSB5xRBk1hTj1qqBJ6s4vK/OfGD/jae7aTmXiGSm8wpJORosNtQevJQ==",
|
||||
"path": "steamworks.net/20.1.0",
|
||||
"hashPath": "steamworks.net.20.1.0.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:StgSharp.Math.Calc.ASin(System.Single)">
|
||||
<summary>
|
||||
Reurns the value of ArcSin(x)
|
||||
</summary>
|
||||
<param name="x">The sine value of the angle</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.ArgumentException"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Exp(System.Single)">
|
||||
<summary>
|
||||
Get the value of E ^ x;
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.GetBits32(System.Single)">
|
||||
<summary>
|
||||
Get the bits of a float number
|
||||
</summary>
|
||||
<param name="x">The given float number</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Log(System.Single)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<returns>
|
||||
Returns the value of ln(x).
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Pow(System.Single,System.Single)">
|
||||
<summary>
|
||||
calculate the value of x^y
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<param name="y"></param>
|
||||
<returns>Returns the value of x^y</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
c037a45127bb9a5e3e153dd0686c8ec78e62d669
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = StgSharp
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
c037a45127bb9a5e3e153dd0686c8ec78e62d669
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
is_global = true
|
||||
build_property.RootNamespace = StgSharp
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
0fc25006e106f23a3259d14620e7ae6858fe601c
|
||||
@@ -0,0 +1,24 @@
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\bin\Debug\netstandard2.1\StgSharp.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\bin\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\bin\Debug\netstandard2.1\StgSharp.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\obj\Debug\netstandard2.1\StgSharp.csproj.AssemblyReference.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\obj\Debug\netstandard2.1\StgSharp.GeneratedMSBuildEditorConfig.editorconfig
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\obj\Debug\netstandard2.1\StgSharp.AssemblyInfoInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\obj\Debug\netstandard2.1\StgSharp.AssemblyInfo.cs
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\obj\Debug\netstandard2.1\StgSharp.csproj.CoreCompileInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\obj\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\StgSharp\StgSharp\obj\Debug\netstandard2.1\StgSharp.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.csproj.AssemblyReference.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.GeneratedMSBuildEditorConfig.editorconfig
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.AssemblyInfoInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.AssemblyInfo.cs
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.csproj.CoreCompileInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\bin\Debug\netstandard2.1\StgSharp.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\bin\Debug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\bin\Debug\netstandard2.1\StgSharp.pdb
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\bin\Debug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\refint\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\.Net\StgSharp\obj\Debug\netstandard2.1\ref\StgSharp.dll
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:StgSharp.Math.Calc.ASin(System.Single)">
|
||||
<summary>
|
||||
Reurns the value of ArcSin(x)
|
||||
</summary>
|
||||
<param name="x">The sine value of the angle</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.ArgumentException"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Exp(System.Single)">
|
||||
<summary>
|
||||
Get the value of E ^ x;
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.GetBits32(System.Single)">
|
||||
<summary>
|
||||
Get the bits of a float number
|
||||
</summary>
|
||||
<param name="x">The given float number</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Log(System.Single)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<returns>
|
||||
Returns the value of ln(x).
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Pow(System.Single,System.Single)">
|
||||
<summary>
|
||||
calculate the value of x^y
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<param name="y"></param>
|
||||
<returns>Returns the value of x^y</returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1 @@
|
||||
obj\Debug\netstandard2.1\\_IsIncrementalBuild
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"projectName": "StgSharp",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"packagesPath": "C:\\Users\\Nitlo\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Nitlo\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"netstandard2.1"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.1": {
|
||||
"targetAlias": "netstandard2.1",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.1": {
|
||||
"targetAlias": "netstandard2.1",
|
||||
"dependencies": {
|
||||
"GLFWDotNet": {
|
||||
"target": "Package",
|
||||
"version": "[20.9.0, )"
|
||||
},
|
||||
"Microsoft.CSharp": {
|
||||
"target": "Package",
|
||||
"version": "[4.7.0, )"
|
||||
},
|
||||
"Steamworks.NET": {
|
||||
"target": "Package",
|
||||
"version": "[20.1.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"NETStandard.Library": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.101\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Nitlo\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Nitlo\.nuget\packages\" />
|
||||
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
@@ -0,0 +1,266 @@
|
||||
{
|
||||
"version": 3,
|
||||
"targets": {
|
||||
".NETStandard,Version=v2.1": {
|
||||
"GLFWDotNet/20.9.0": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"lib/netstandard2.1/GLFWDotNet.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/GLFWDotNet.dll": {}
|
||||
},
|
||||
"runtimeTargets": {
|
||||
"runtimes/win-x64/native/glfw3.dll": {
|
||||
"assetType": "native",
|
||||
"rid": "win-x64"
|
||||
},
|
||||
"runtimes/win-x86/native/glfw3.dll": {
|
||||
"assetType": "native",
|
||||
"rid": "win-x86"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"ref/netstandard2.0/Microsoft.CSharp.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.CSharp.dll": {
|
||||
"related": ".xml"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Steamworks.NET/20.1.0": {
|
||||
"type": "package",
|
||||
"compile": {
|
||||
"ref/netstandard2.1/Steamworks.NET.dll": {}
|
||||
},
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/Steamworks.NET.dll": {}
|
||||
},
|
||||
"runtimeTargets": {
|
||||
"runtimes/linux-x64/lib/netstandard2.1/Steamworks.NET.dll": {
|
||||
"assetType": "runtime",
|
||||
"rid": "linux-x64"
|
||||
},
|
||||
"runtimes/linux-x86/lib/netstandard2.1/Steamworks.NET.dll": {
|
||||
"assetType": "runtime",
|
||||
"rid": "linux-x86"
|
||||
},
|
||||
"runtimes/osx-x64/lib/netstandard2.1/Steamworks.NET.dll": {
|
||||
"assetType": "runtime",
|
||||
"rid": "osx-x64"
|
||||
},
|
||||
"runtimes/osx-x86/lib/netstandard2.1/Steamworks.NET.dll": {
|
||||
"assetType": "runtime",
|
||||
"rid": "osx-x86"
|
||||
},
|
||||
"runtimes/win-x64/lib/netstandard2.1/Steamworks.NET.dll": {
|
||||
"assetType": "runtime",
|
||||
"rid": "win-x64"
|
||||
},
|
||||
"runtimes/win-x86/lib/netstandard2.1/Steamworks.NET.dll": {
|
||||
"assetType": "runtime",
|
||||
"rid": "win-x86"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"GLFWDotNet/20.9.0": {
|
||||
"sha512": "fWonCs+BBqeK5R8t0g293RPoqerH27FHNcPyL/Hbxe0Ap4QCNKhQYf2tXJU1XTMf1ZbuLmM1MY5lonV35eGw6Q==",
|
||||
"type": "package",
|
||||
"path": "glfwdotnet/20.9.0",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"License.txt",
|
||||
"glfwdotnet.20.9.0.nupkg.sha512",
|
||||
"glfwdotnet.nuspec",
|
||||
"lib/netstandard2.1/GLFW.license",
|
||||
"lib/netstandard2.1/GLFWDotNet.dll",
|
||||
"runtimes/win-x64/native/glfw3.dll",
|
||||
"runtimes/win-x86/native/glfw3.dll"
|
||||
]
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"sha512": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
|
||||
"type": "package",
|
||||
"path": "microsoft.csharp/4.7.0",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"LICENSE.TXT",
|
||||
"THIRD-PARTY-NOTICES.TXT",
|
||||
"lib/MonoAndroid10/_._",
|
||||
"lib/MonoTouch10/_._",
|
||||
"lib/net45/_._",
|
||||
"lib/netcore50/Microsoft.CSharp.dll",
|
||||
"lib/netcoreapp2.0/_._",
|
||||
"lib/netstandard1.3/Microsoft.CSharp.dll",
|
||||
"lib/netstandard2.0/Microsoft.CSharp.dll",
|
||||
"lib/netstandard2.0/Microsoft.CSharp.xml",
|
||||
"lib/portable-net45+win8+wp8+wpa81/_._",
|
||||
"lib/uap10.0.16299/_._",
|
||||
"lib/win8/_._",
|
||||
"lib/wp80/_._",
|
||||
"lib/wpa81/_._",
|
||||
"lib/xamarinios10/_._",
|
||||
"lib/xamarinmac20/_._",
|
||||
"lib/xamarintvos10/_._",
|
||||
"lib/xamarinwatchos10/_._",
|
||||
"microsoft.csharp.4.7.0.nupkg.sha512",
|
||||
"microsoft.csharp.nuspec",
|
||||
"ref/MonoAndroid10/_._",
|
||||
"ref/MonoTouch10/_._",
|
||||
"ref/net45/_._",
|
||||
"ref/netcore50/Microsoft.CSharp.dll",
|
||||
"ref/netcore50/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/de/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/es/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/fr/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/it/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/ja/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/ko/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/ru/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/zh-hans/Microsoft.CSharp.xml",
|
||||
"ref/netcore50/zh-hant/Microsoft.CSharp.xml",
|
||||
"ref/netcoreapp2.0/_._",
|
||||
"ref/netstandard1.0/Microsoft.CSharp.dll",
|
||||
"ref/netstandard1.0/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/de/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/es/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/fr/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/it/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/ja/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/ko/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/ru/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/zh-hans/Microsoft.CSharp.xml",
|
||||
"ref/netstandard1.0/zh-hant/Microsoft.CSharp.xml",
|
||||
"ref/netstandard2.0/Microsoft.CSharp.dll",
|
||||
"ref/netstandard2.0/Microsoft.CSharp.xml",
|
||||
"ref/portable-net45+win8+wp8+wpa81/_._",
|
||||
"ref/uap10.0.16299/_._",
|
||||
"ref/win8/_._",
|
||||
"ref/wp80/_._",
|
||||
"ref/wpa81/_._",
|
||||
"ref/xamarinios10/_._",
|
||||
"ref/xamarinmac20/_._",
|
||||
"ref/xamarintvos10/_._",
|
||||
"ref/xamarinwatchos10/_._",
|
||||
"useSharedDesignerContext.txt",
|
||||
"version.txt"
|
||||
]
|
||||
},
|
||||
"Steamworks.NET/20.1.0": {
|
||||
"sha512": "+GntwnyJ5tCNvUIaQxv2+ehDvZJzGUqlSB5xRBk1hTj1qqBJ6s4vK/OfGD/jae7aTmXiGSm8wpJORosNtQevJQ==",
|
||||
"type": "package",
|
||||
"path": "steamworks.net/20.1.0",
|
||||
"files": [
|
||||
".nupkg.metadata",
|
||||
".signature.p7s",
|
||||
"lib/netstandard2.1/Steamworks.NET.dll",
|
||||
"readme.md",
|
||||
"ref/netstandard2.1/Steamworks.NET.dll",
|
||||
"runtimes/linux-x64/lib/netstandard2.1/Steamworks.NET.dll",
|
||||
"runtimes/linux-x86/lib/netstandard2.1/Steamworks.NET.dll",
|
||||
"runtimes/osx-x64/lib/netstandard2.1/Steamworks.NET.dll",
|
||||
"runtimes/osx-x86/lib/netstandard2.1/Steamworks.NET.dll",
|
||||
"runtimes/win-x64/lib/netstandard2.1/Steamworks.NET.dll",
|
||||
"runtimes/win-x86/lib/netstandard2.1/Steamworks.NET.dll",
|
||||
"steamworks.net.20.1.0.nupkg.sha512",
|
||||
"steamworks.net.nuspec"
|
||||
]
|
||||
}
|
||||
},
|
||||
"projectFileDependencyGroups": {
|
||||
".NETStandard,Version=v2.1": [
|
||||
"GLFWDotNet >= 20.9.0",
|
||||
"Microsoft.CSharp >= 4.7.0",
|
||||
"Steamworks.NET >= 20.1.0"
|
||||
]
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\Nitlo\\.nuget\\packages\\": {},
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"projectName": "StgSharp",
|
||||
"projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"packagesPath": "C:\\Users\\Nitlo\\.nuget\\packages\\",
|
||||
"outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"fallbackFolders": [
|
||||
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
|
||||
],
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\Nitlo\\AppData\\Roaming\\NuGet\\NuGet.Config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
|
||||
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"netstandard2.1"
|
||||
],
|
||||
"sources": {
|
||||
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
|
||||
"C:\\Program Files\\dotnet\\library-packs": {},
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.1": {
|
||||
"targetAlias": "netstandard2.1",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
}
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard2.1": {
|
||||
"targetAlias": "netstandard2.1",
|
||||
"dependencies": {
|
||||
"GLFWDotNet": {
|
||||
"target": "Package",
|
||||
"version": "[20.9.0, )"
|
||||
},
|
||||
"Microsoft.CSharp": {
|
||||
"target": "Package",
|
||||
"version": "[4.7.0, )"
|
||||
},
|
||||
"Steamworks.NET": {
|
||||
"target": "Package",
|
||||
"version": "[20.1.0, )"
|
||||
}
|
||||
},
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"frameworkReferences": {
|
||||
"NETStandard.Library": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.101\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "D2b6GMfOY4aZxUai0LnRuWyULH+CEG98xFRXi9OAg3hVh5QYpI8wa9Penb+96fBCHHpWEQ22IzA65zYWs4fy2g==",
|
||||
"success": true,
|
||||
"projectFilePath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\.Net\\StgSharp\\StgSharp.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\Nitlo\\.nuget\\packages\\glfwdotnet\\20.9.0\\glfwdotnet.20.9.0.nupkg.sha512",
|
||||
"C:\\Users\\Nitlo\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512",
|
||||
"C:\\Users\\Nitlo\\.nuget\\packages\\steamworks.net\\20.1.0\\steamworks.net.20.1.0.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
||||
Reference in New Issue
Block a user