Daily update on 20221022

This commit is contained in:
Youmu Konpaku
2022-10-23 03:12:20 +08:00
parent 003bc4ed27
commit eae4317e6e
102 changed files with 1162312 additions and 73 deletions
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
namespace StgSharp_Geometry
{
internal unsafe class Circle
internal unsafe class Circle:Geometry
{
private Point _center;
@@ -31,8 +31,9 @@ namespace StgSharp_Geometry
this._radius = radius;
}
public void BindPoint(float angle,int number,SimpleContainer geoItemPool)
public void BindPoint(float angle,int number,GeometryContainer geoItemPool)
{
for (int i = 1; i <= number; i++)
{
@@ -0,0 +1,41 @@
using StgSharp_Geometry;
using StgSharp_Logic;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp_Geometry
{
internal class Geometry:LinkedTarget
{
public new LinkedTarget Previous
{
get { return this.Previous; }
set
{
if (value is Geometry)
{
this.Previous = value;
}
}
}
public new LinkedTarget Next
{
get { return this.Next; }
set
{
if (value is Geometry)
{
this.Next = value;
}
}
}
public virtual void Add()
{ }
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp_Geometry
{
internal class Line
{
private Point _beginPoint;
public Point BeginPoint
{
get { return _beginPoint; }
set { _beginPoint = value; }
}
private Point _endingPoint;
public Point EndingPoint
{
get { return _endingPoint; }
set { _endingPoint = value; }
}
public Line(Point begin,Point end)
{
_beginPoint= begin;
_endingPoint= end;
}
}
}
@@ -25,7 +25,20 @@ namespace StgSharp_Geometry
set { _y = value; }
}
public new LinkedTarget Next
{
get { return this.Next; }
set
{
if (value is Point)
{
this.Next = value;
}
}
}
public virtual void OnRender()
{ }
}
}
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace StgSharp_Geometry
{
internal class PointOnCircle : Point
internal unsafe class PointOnCircle : Point
{
private Circle _bindedItem;
@@ -25,12 +25,15 @@ namespace StgSharp_Geometry
}
private float[] _angularVelocity;
private readonly uint beginTick;
private readonly uint* nowtick;
public PointOnCircle(Circle c, float p, float angle, int counts)
public PointOnCircle(Circle c, float p, float angle, uint counts,uint* gameTick)
{
_bindedItem = c;
_angle = (angle + counts * (360.0f / counts))*(float)(2*Math.PI/360);
nowtick = gameTick;
beginTick = *gameTick;
}
public void AddRotation(float[] aFunc)
@@ -44,18 +47,20 @@ namespace StgSharp_Geometry
throw new Exception("Parameters are too much or too few!");
}
}
public void onRender()
public override void OnRender()
{
if (_angularVelocity!=null)
{
uint a = *nowtick - beginTick;
float deltaAngle = 0;
for (int i = 0; i < 10; i++)
{
deltaAngle += _angularVelocity[i];
deltaAngle *= a;
}
_angle+=deltaAngle;
}
this.X = (float)(_bindedItem.Center.X + _bindedItem.Radius * Math.Cos(_angle));
this.Y = (float)(_bindedItem.Center.X + _bindedItem.Radius * Math.Sin(_angle));
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp_Geometry
{
internal class PointOnLine : Point
{
private Point _beginPoint;
public Point BeginPoint
{
get { return _beginPoint; }
set { _beginPoint = value; }
}
private Point _endPoint;
public Point EndPoint
{
get { return _endPoint; }
set { _endPoint = value; }
}
private float _angle;
public float Angle
{
get { return _angle; }
set { _angle = value; }
}
private float rate;
public PointOnLine(Point beginPoint,Point endPoint,float rate,int number)
{
_beginPoint = beginPoint;
_endPoint = endPoint;
_angle = (float)(Math.Atan2(endPoint.Y-beginPoint.Y,endPoint.X-beginPoint.Y));
rate = rate * number;
this.Y = beginPoint.Y + rate * (endPoint.Y - beginPoint.Y);
this.X = beginPoint.X + rate * (endPoint.X - beginPoint.X);
}
public override void OnRender()
{
_angle = (float)(Math.Atan2(_endPoint.Y - _beginPoint.Y, _endPoint.X - _beginPoint.Y));
this.Y = _beginPoint.Y + rate * (_endPoint.Y - _beginPoint.Y);
this.X = _beginPoint.X + rate * (_endPoint.X - _beginPoint.X);
}
}
}
@@ -46,6 +46,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Circle.cs" />
<Compile Include="Geometry.cs" />
<Compile Include="Line.cs" />
<Compile Include="PointOnLine.cs" />
<Compile Include="PointOnCircle.cs" />
<Compile Include="Point.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />