daily update on 20240407 by nitload youmu

This commit is contained in:
YoumuLiu
2024-04-07 15:08:52 +08:00
parent 127fcdbfd3
commit e1e416bb41
141 changed files with 2578 additions and 2576 deletions
@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Math
{
public static partial class GeometryScaler
{
internal const float DegToRad = 180 / Scaler.Pi;
public static Degree ToDegree(float value)
{
return new Degree(value);
}
public static float Sin(Radius r)
{
return MathF.Sin(r._radius);
}
public static float Tan(Radius r)
{
return MathF.Tan(r._radius);
}
public static float Cos(Radius r)
{
return MathF.Cos(r._radius);
}
public static float Sin(Degree r)
{
return MathF.Sin(r._degree);
}
public static float Tan(Degree r)
{
return MathF.Tan(r._degree);
}
public static float Cos(Degree r)
{
return MathF.Cos(r._degree);
}
}
public struct Degree
{
internal float _degree;
internal Degree(float dgree)
{
_degree = dgree;
}
public Radius ToRadius()
{
return new Radius(_degree / GeometryScaler.DegToRad);
}
}
public struct Radius
{
internal float _radius;
public static Radius Zero
{
get =>new Radius(0);
}
public Radius(float radius)
{
_radius = radius;
}
[Obsolete("Unsafe, you may forget this is radius.",true)]
public Radius() { }
public Degree ToDegree()
{
return new Degree(_radius * 180 / Scaler.Pi);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator -(Radius r)
{
return new Radius(-r._radius);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator -(Radius left, Radius Right)
{
return new Radius(left._radius - Right._radius);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator +(Radius left, Radius Right)
{
return new Radius(left._radius + Right._radius);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator *(Radius left, float right)
{
return new Radius(left._radius * right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Radius operator /(Radius left, float right)
{
return new Radius(left._radius / right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(Radius left, Radius right)
{
return left._radius == right._radius;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(Radius left, Radius right)
{
return left._radius != right._radius;
}
}
}
@@ -44,7 +44,7 @@ namespace StgSharp.Geometries
public struct PartialPlainCoordinate
{
internal Matrix3x2 axis;
internal Matrix32 axis;
/// <summary>
/// The origin of this coordinate.
@@ -59,7 +59,7 @@ namespace StgSharp.Geometries
)
{
this.origin = origin;
axis = new Matrix3x2();
axis = new Matrix32();
#if NET5_0_OR_GREATER
Unsafe.SkipInit(out axis.mat);
#endif
@@ -42,7 +42,7 @@ namespace StgSharp.Geometries
protected TimeSpanProvider time;
internal PartialPlainCoordinate coordinate;
internal Matrix2x4 textureFrame;
internal Matrix24 textureFrame;
public PlainGeometry()
{
@@ -43,7 +43,7 @@ namespace StgSharp.Geometries
internal readonly GetLocationHandler moveVertex2Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal readonly GetLocationHandler moveVertex3Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal Matrix2x4 vertexMat;
internal Matrix24 vertexMat;
internal Polygon4()
{
@@ -30,7 +30,7 @@
//-----------------------------------------------------------------------
using StgSharp.Controlling;
using StgSharp.Math;
using StgSharp.Math.Linear;
using System.Numerics;
@@ -30,7 +30,7 @@
//-----------------------------------------------------------------------
using StgSharp.Controlling;
using StgSharp.Math;
using StgSharp.Math.Linear;
using System.Numerics;
@@ -44,11 +44,11 @@ namespace StgSharp.Geometries
internal GetLocationHandler movVertex02Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal GetLocationHandler movVertex03Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
internal Matrix3x3 vertexMat;
internal Matrix33 vertexMat;
public Triangle()
{
vertexMat = new Matrix3x3();
vertexMat = new Matrix33();
}
public Triangle(