daily update on 20230418 by nitload youmu.
rewrite of geometry is completed. ready for release of ver0.1.0
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -11,11 +11,5 @@ namespace StgSharp.Control
|
|||||||
{
|
{
|
||||||
GameTimeLine.allPool.Add(pool);
|
GameTimeLine.allPool.Add(pool);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Geometry(IPlainGeometry geometry)
|
|
||||||
{
|
|
||||||
GameTimeLine._currentPool.geometryContainer.Add(geometry);
|
|
||||||
GameTimeLine._currentPool.pointContainer.Add(geometry.RefPoint);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using StgSharp.Linear;
|
using StgSharp.Math;
|
||||||
using StgSharp.Math;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
@@ -10,73 +9,38 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
public class Arc : IPlainGeometry
|
public class Arc : IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _basePoint;
|
internal Point center;
|
||||||
internal Point _center;
|
internal Point beginPoint;
|
||||||
internal Point _beginPoint;
|
internal Point endPoint;
|
||||||
internal Point _endPoint;
|
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal RenderMode _renderMode;
|
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal readonly uint bornTick;
|
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
|
||||||
public Arc(uint bornTime) : base(bornTime)
|
public override Point RefPoint01 => center;
|
||||||
{
|
|
||||||
bornTick = bornTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Arc(Counter<uint> tickCounter) : base(tickCounter)
|
public override Point RefPoint02 => beginPoint;
|
||||||
{
|
|
||||||
bornTick = tickCounter._value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Point RefOrigin => _basePoint;
|
public override Point RefPoint03 => endPoint;
|
||||||
|
|
||||||
public override Point RefPoint01 => _center;
|
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
||||||
|
|
||||||
public override Point RefPoint02 => _beginPoint;
|
public virtual vec3d MovBegin(uint tick) => movBeginOperation.Invoke(tick);
|
||||||
|
|
||||||
public override Point RefPoint03 => _endPoint;
|
public virtual vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
|
||||||
|
|
||||||
public virtual vec3d MoveCenter(uint tick) => default;
|
|
||||||
|
|
||||||
public virtual vec3d UpdateRadius(uint tick) => default;
|
|
||||||
|
|
||||||
public virtual vec3d UpdateAngle(uint tick) => default;
|
|
||||||
|
|
||||||
internal override void OnRender(uint tick)
|
internal override void OnRender(uint tick)
|
||||||
{
|
{
|
||||||
tick-=bornTick;
|
tick-= bornTick;
|
||||||
_center._position = _basePoint._position + MoveCenter(tick);
|
center._position = refOrigin._position + MoveCenter(tick);
|
||||||
switch (_renderMode)
|
beginPoint._position = refOrigin._position + MovBegin(tick);
|
||||||
{
|
endPoint._position = refOrigin._position + MovEnd(tick);
|
||||||
case RenderMode.BasePoint:
|
|
||||||
_beginPoint._position = _basePoint._position + UpdateRadius(tick);
|
|
||||||
_endPoint._position = _basePoint._position + UpdateAngle(tick);
|
|
||||||
break;
|
|
||||||
case RenderMode.RefPoint:
|
|
||||||
_beginPoint._position = _center._position + UpdateRadius(tick);
|
|
||||||
_endPoint._position = _center._position + UpdateAngle(tick);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float SetArrayX()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float SetArrayY()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Line[] GetAllSides() => throw new NotImplementedException();
|
public override Line[] GetAllSides() => throw new NotImplementedException();
|
||||||
|
|
||||||
public override Plain GetPlain()
|
public override Plain GetPlain()
|
||||||
{
|
{
|
||||||
return new Plain(this._center,this._beginPoint,this._endPoint);
|
return new Plain(this.center,this.beginPoint,this.endPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using StgSharp.Linear;
|
using StgSharp.Math;
|
||||||
using StgSharp.Math;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -8,71 +7,37 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
public class Circle : IPlainGeometry
|
public class Circle : IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _baseCenter;
|
internal Point center;
|
||||||
internal Point _center;
|
internal Point pointOnCircle;
|
||||||
internal Point _pointOnCircle;
|
internal Point pointOnPlain;
|
||||||
internal Point _pointOnPlain;
|
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal RenderMode _renderMode;
|
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal readonly uint bornTick;
|
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
|
||||||
public override Point RefOrigin => _baseCenter;
|
|
||||||
|
|
||||||
public override Point RefPoint01 => _center;
|
public override Point RefPoint01 => center;
|
||||||
|
|
||||||
public override Point RefPoint02 => _pointOnCircle;
|
public override Point RefPoint02 => pointOnCircle;
|
||||||
|
|
||||||
public override Point RefPoint03 => _pointOnPlain;
|
public override Point RefPoint03 => pointOnPlain;
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
||||||
|
|
||||||
public Circle(uint bornTime) : base(bornTime)
|
public virtual vec3d UpdateRadius(uint tick) => movBeginOperation.Invoke(tick);
|
||||||
{
|
|
||||||
bornTick = bornTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Circle(Counter<uint> tickCounter) : base(tickCounter)
|
public virtual vec3d UpdatePlain(uint tick) => movEndOperation.Invoke(tick);
|
||||||
{
|
|
||||||
bornTick = tickCounter._value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual vec3d MoveCenter(uint tick) => default;
|
|
||||||
|
|
||||||
public virtual vec3d UpdateRadius(uint tick) => default;
|
|
||||||
|
|
||||||
public virtual vec3d UpdatePlain(uint tick) => default;
|
|
||||||
|
|
||||||
public override float SetArrayX()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float SetArrayY()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Plain GetPlain()
|
public override Plain GetPlain()
|
||||||
{
|
{
|
||||||
return new Plain(_center,_pointOnCircle,_pointOnPlain);
|
return new Plain(center, pointOnCircle, pointOnPlain);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override void OnRender(uint tick)
|
internal override void OnRender(uint tick)
|
||||||
{
|
{
|
||||||
tick-=bornTick;
|
tick-=bornTick;
|
||||||
_center._position = MoveCenter(tick);
|
center._position = refOrigin._position + MoveCenter(tick);
|
||||||
switch (_renderMode)
|
pointOnCircle._position = refOrigin._position + UpdateRadius(tick);
|
||||||
{
|
pointOnPlain._position = refOrigin._position + UpdatePlain(tick);
|
||||||
case RenderMode.BasePoint:
|
|
||||||
_pointOnCircle._position = _baseCenter._position + UpdateRadius(tick);
|
|
||||||
_pointOnPlain._position = _baseCenter._position + UpdatePlain(tick);
|
|
||||||
break;
|
|
||||||
case RenderMode.RefPoint:
|
|
||||||
_pointOnCircle._position = _center._position + UpdateRadius(tick);
|
|
||||||
_pointOnPlain._position = _center._position + UpdatePlain(tick);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
|
|||||||
+10
-1
@@ -11,5 +11,14 @@ namespace StgSharp.Geometries
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tickCounter"></param>
|
/// <param name="tickCounter"></param>
|
||||||
/// <returns>表示位移量的三维矢量</returns>
|
/// <returns>表示位移量的三维矢量</returns>
|
||||||
public delegate vec3d GetLocationHandler(Counter<uint> tickCounter);
|
public delegate vec3d GetLocationHandler(uint tick);
|
||||||
|
|
||||||
|
public static unsafe class GeometryOperation
|
||||||
|
{
|
||||||
|
public static vec3d DefualtMotion(uint tick)
|
||||||
|
{
|
||||||
|
return default(vec3d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using StgSharp.Linear;
|
using StgSharp.Math;
|
||||||
using StgSharp.Math;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -12,9 +11,10 @@ namespace StgSharp.Geometries
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class IPlainGeometry:INode<IPlainGeometry>
|
public abstract class IPlainGeometry:INode<IPlainGeometry>
|
||||||
{
|
{
|
||||||
private readonly uint bornTick;
|
protected readonly uint bornTick;
|
||||||
|
internal readonly Point refOrigin;
|
||||||
|
|
||||||
public abstract Point RefOrigin { get; }
|
public Point RefOrigin { get { return refOrigin; } }
|
||||||
public abstract Point RefPoint01{ get; }
|
public abstract Point RefPoint01{ get; }
|
||||||
public abstract Point RefPoint02{ get; }
|
public abstract Point RefPoint02{ get; }
|
||||||
public abstract Point RefPoint03{ get; }
|
public abstract Point RefPoint03{ get; }
|
||||||
@@ -34,10 +34,6 @@ namespace StgSharp.Geometries
|
|||||||
|
|
||||||
|
|
||||||
internal abstract void OnRender(uint tick);
|
internal abstract void OnRender(uint tick);
|
||||||
|
|
||||||
public abstract RenderMode renderMode { get; }
|
|
||||||
public abstract float SetArrayX();
|
|
||||||
public abstract float SetArrayY();
|
|
||||||
|
|
||||||
public abstract Line[] GetAllSides();
|
public abstract Line[] GetAllSides();
|
||||||
|
|
||||||
@@ -46,17 +42,4 @@ namespace StgSharp.Geometries
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum RenderMode
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 坐标点将基于参考原点构建
|
|
||||||
/// </summary>
|
|
||||||
BasePoint,
|
|
||||||
/// <summary>
|
|
||||||
/// 坐标点将基于参考起点构建
|
|
||||||
/// </summary>
|
|
||||||
RefPoint
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using Steamworks;
|
using Steamworks;
|
||||||
using StgSharp;
|
using StgSharp;
|
||||||
using StgSharp.Control;
|
using StgSharp.Control;
|
||||||
using StgSharp.Linear;
|
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -11,83 +10,37 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
public class Line:IPlainGeometry
|
public class Line:IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _basePoint = default ;
|
internal Point basePoint = default ;
|
||||||
internal Point _beginPoint = default ;
|
internal Point beginPoint = default ;
|
||||||
internal Point _endPoint = default;
|
internal Point endPoint = default;
|
||||||
internal GetLocationHandler movBegin;
|
internal GetLocationHandler movBegin;
|
||||||
internal GetLocationHandler movEnd;
|
internal GetLocationHandler movEnd;
|
||||||
internal RenderMode _renderMode;
|
|
||||||
internal readonly uint bornTick;
|
|
||||||
|
|
||||||
public override Point RefOrigin => _basePoint;
|
public override Point RefPoint01 => beginPoint;
|
||||||
|
public override Point RefPoint02 => endPoint;
|
||||||
public override Point RefPoint => _beginPoint;
|
public override Point RefPoint03 => default;
|
||||||
|
|
||||||
public override Point RefVec01 => _endPoint;
|
|
||||||
public override Point RefVec02 => default;
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
|
||||||
|
|
||||||
public Line(uint bornTime) : base(bornTime)
|
|
||||||
{
|
|
||||||
bornTick = bornTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Line(Counter<uint> tickCounter) : base(tickCounter)
|
|
||||||
{
|
|
||||||
bornTick = tickCounter._value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Line(Point begin, Point end)
|
public Line(Point begin, Point end)
|
||||||
{
|
{
|
||||||
this._beginPoint = begin;
|
this.beginPoint = begin;
|
||||||
this._endPoint = end;
|
this.endPoint = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Line() { }
|
public Line() { }
|
||||||
|
|
||||||
public override float SetArrayX()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float SetArrayY()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal sealed override void CalcVec01(uint tick)
|
|
||||||
{
|
|
||||||
_beginPoint._position = _basePoint._position + MoveBeginPoint(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal sealed override void CalcVec02(vec3d vec, uint tick)
|
|
||||||
{
|
|
||||||
_endPoint._position = vec + MoveEndPoint(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
//计算线起点的方法,通过对线的派生的重写实现功能
|
//计算线起点的方法,通过对线的派生的重写实现功能
|
||||||
public virtual vec3d MoveBeginPoint(uint tick)
|
public virtual vec3d MoveBeginPoint(uint tick)
|
||||||
=> movBegin.Invoke( GameTimeLine.tickCounter);
|
=> movBegin.Invoke(tick);
|
||||||
|
|
||||||
//计算线重点的方法,通过对线的派生的重写实现功能
|
//计算线重点的方法,通过对线的派生的重写实现功能
|
||||||
public virtual vec3d MoveEndPoint(uint tick)
|
public virtual vec3d MoveEndPoint(uint tick)
|
||||||
=> movEnd.Invoke( GameTimeLine.tickCounter);
|
=> movEnd.Invoke(tick);
|
||||||
|
|
||||||
internal override void OnRender(uint tick)
|
internal override void OnRender(uint tick)
|
||||||
{
|
{
|
||||||
tick -= bornTick;
|
tick -= bornTick;
|
||||||
CalcVec01(tick);
|
beginPoint._position = refOrigin._position + MoveBeginPoint(tick);
|
||||||
switch (_renderMode)
|
endPoint._position = refOrigin._position + MoveEndPoint(tick);
|
||||||
{
|
|
||||||
case RenderMode.BasePoint:
|
|
||||||
CalcVec02(_basePoint._position, tick);
|
|
||||||
break;
|
|
||||||
case RenderMode.RefPoint:
|
|
||||||
CalcVec02(_beginPoint._position, tick);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using StgSharp.Control;
|
using StgSharp.Control;
|
||||||
using StgSharp.Linear;
|
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -7,151 +6,48 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
internal class Parallelogram : IPlainGeometry
|
internal class Parallelogram : Polygon4
|
||||||
{
|
{
|
||||||
internal Point _basePoint;
|
internal Point center;
|
||||||
internal Point _center;
|
|
||||||
internal Point _vertex1;
|
|
||||||
internal Point _vertex2;
|
|
||||||
internal RenderMode _renderMode;
|
|
||||||
internal readonly uint bornTick;
|
|
||||||
|
|
||||||
public override sealed Point RefOrigin => _basePoint;
|
public override sealed Point RefPoint01 => center;
|
||||||
public override sealed Point RefPoint => _center;
|
public sealed override Point RefPoint02 => vertex01;
|
||||||
|
public sealed override Point RefPoint03 => vertex02;
|
||||||
|
|
||||||
public override sealed Point RefVec01 => _vertex1;
|
internal readonly GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
|
||||||
public override sealed Point RefVec02 => _vertex2;
|
public GetLocationHandler MovCenterOperation { get { return movCenterOperation; } }
|
||||||
|
public GetLocationHandler MovVertex01Operation { get { return movVertex01Operation; } }
|
||||||
|
public GetLocationHandler MovVertex02Operation { get { return movVertex02Operation; } }
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
public virtual vec3d MovCenter(uint tick)
|
||||||
|
|
||||||
public Parallelogram(uint bornTime) : base(bornTime)
|
|
||||||
{
|
{
|
||||||
bornTick = bornTime;
|
return movCenterOperation.Invoke(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Parallelogram(Counter<uint> tickCounter) : base(tickCounter)
|
/// <summary>
|
||||||
|
/// 移动平行四边形的第三个顶点,是一个多余的方法,调用会引发多余变量异常
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tick">当前游戏刻</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="UnusedVertexException">几何体过定义</exception>
|
||||||
|
public sealed override vec3d MovVertex03(uint tick)
|
||||||
{
|
{
|
||||||
bornTick = tickCounter._value;
|
throw new UnusedVertexException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public sealed override vec3d MovVertex04(uint tick)
|
||||||
|
{
|
||||||
|
throw new UnusedVertexException();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override sealed void OnRender(uint tick)
|
internal override sealed void OnRender(uint tick)
|
||||||
{
|
{
|
||||||
tick -= bornTick;
|
uint nowTick = GameTimeLine.tickCounter._value;
|
||||||
CalcVec01(tick);
|
this.vertex01._position = RefOrigin._position + movVertex01Operation(nowTick);
|
||||||
switch (renderMode)
|
this.vertex02._position = RefOrigin._position + movVertex02Operation(nowTick);
|
||||||
{
|
this.vertex03._position = 2 * center._position - vertex01._position;
|
||||||
case RenderMode.BasePoint:
|
this.vertex04._position = 2 * center._position - vertex02._position;
|
||||||
CalcVec02(_basePoint._position, tick);
|
|
||||||
CalcVec03(_basePoint._position, tick);
|
|
||||||
break;
|
|
||||||
case RenderMode.RefPoint:
|
|
||||||
CalcVec02(_center._position, tick);
|
|
||||||
CalcVec03(_center._position, tick);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override sealed float SetArrayX()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override sealed float SetArrayY()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
//计算参考中心点的位移
|
|
||||||
internal override void CalcVec01(uint tick)
|
|
||||||
{
|
|
||||||
_center._position = _basePoint._position + MovCenter(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
//计算第一个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
|
|
||||||
internal override void CalcVec02(vec3d vec, uint tick)
|
|
||||||
{
|
|
||||||
_vertex1._position = vec + UpdateCTC1(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
//计算第二个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
|
|
||||||
internal override void CalcVec03(vec3d vec, uint tick)
|
|
||||||
{
|
|
||||||
_vertex2._position = vec + UpdateCTC2(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
internal sealed override void CalcVec04(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec05(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec06(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec07(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec08(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec09(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec10(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec11(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec12(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec13(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec14(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec15(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec16(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
|
|
||||||
public virtual vec3d MovCenter(uint tick) => default(vec3d);
|
|
||||||
|
|
||||||
public virtual vec3d UpdateCTC1(uint tick) => default(vec3d);
|
|
||||||
|
|
||||||
public virtual vec3d UpdateCTC2(uint tick) => default(vec3d);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取平行四边形的全部边
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override Line[] GetAllSides()
|
|
||||||
{
|
|
||||||
|
|
||||||
Line[] sides = new Line[4]
|
|
||||||
{
|
|
||||||
new Line(GameTimeLine.tickCounter),
|
|
||||||
new Line(GameTimeLine.tickCounter),
|
|
||||||
new Line(GameTimeLine.tickCounter),
|
|
||||||
new Line(GameTimeLine.tickCounter),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
sides[0]._basePoint = this._vertex1;
|
|
||||||
sides[0]._beginPoint = this._vertex1;
|
|
||||||
sides[0]._endPoint = this._vertex2;
|
|
||||||
|
|
||||||
sides[1]._basePoint = this._vertex2;
|
|
||||||
sides[1]._beginPoint = this._vertex2;
|
|
||||||
sides[1]._endPoint = new Point() { _position = GetVertex3(GameTimeLine.tickCounter)};
|
|
||||||
sides[1].movEnd += this.GetVertex3;
|
|
||||||
|
|
||||||
sides[2]._basePoint = sides[1]._endPoint;
|
|
||||||
sides[2]._beginPoint = sides[2]._basePoint;
|
|
||||||
sides[2]._endPoint = new Point() { _position = this.GetVertex4(GameTimeLine.tickCounter) };
|
|
||||||
sides[2].movEnd+= this.GetVertex4;
|
|
||||||
|
|
||||||
sides[3]._beginPoint = sides[2]._endPoint;
|
|
||||||
sides[3]._endPoint = this._vertex1;
|
|
||||||
|
|
||||||
return sides;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Plain GetPlain()
|
|
||||||
{
|
|
||||||
return new Plain(this._center, this._vertex1,this._vertex2);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected vec3d GetVertex3(Counter<uint> tick)
|
|
||||||
{
|
|
||||||
return 2 * this._center._position - this._vertex1._position;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected vec3d GetVertex4(Counter<uint> tick)
|
|
||||||
{
|
|
||||||
return 2 * this._center._position - this._vertex2._position;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
using StgSharp.Geometries;
|
using StgSharp.Math;
|
||||||
using StgSharp.Math;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace StgSharp.Linear
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public unsafe class Plain
|
public unsafe class Plain
|
||||||
{
|
{
|
||||||
@@ -13,13 +12,13 @@ namespace StgSharp.Linear
|
|||||||
internal vec3d vec2;
|
internal vec3d vec2;
|
||||||
|
|
||||||
internal vec3d plainParameter;
|
internal vec3d plainParameter;
|
||||||
internal readonly float d = -1 ;
|
internal readonly float d = -1;
|
||||||
|
|
||||||
public Plain(vec3d o, vec3d v1, vec3d v2)
|
public Plain(vec3d o, vec3d v1, vec3d v2)
|
||||||
{
|
{
|
||||||
this.origin = o;
|
this.origin = o;
|
||||||
this.vec1 = v1 - v2 * (v1.Y/v2.Y); //计算平面在xz平面上的方向投影
|
this.vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
|
||||||
this.vec2 = v2 - vec1 * (v2.X/v1.X); //计算平面在yz平面上的方向投影
|
this.vec2 = v2 - vec1 * (v2.X / v1.X); //计算平面在yz平面上的方向投影
|
||||||
|
|
||||||
//|origin|-k1*|vec1|-k2*|vec2|计算plainParameter.Z;
|
//|origin|-k1*|vec1|-k2*|vec2|计算plainParameter.Z;
|
||||||
plainParameter.Z = origin.Z - vec1.Z * (origin.X / vec1.X) - vec2.Z * (origin.Y / vec2.Y);
|
plainParameter.Z = origin.Z - vec1.Z * (origin.X / vec1.X) - vec2.Z * (origin.Y / vec2.Y);
|
||||||
@@ -53,5 +52,4 @@ namespace StgSharp.Linear
|
|||||||
plainParameter.Z = 1 / plainParameter.Z;
|
plainParameter.Z = 1 / plainParameter.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
@@ -9,7 +9,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Point: INode<Point>
|
public class Point : INode<Point>
|
||||||
{
|
{
|
||||||
|
|
||||||
internal vec3d _position;
|
internal vec3d _position;
|
||||||
@@ -24,7 +24,17 @@ namespace StgSharp.Geometries
|
|||||||
get { return this._position.Y; }
|
get { return this._position.Y; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update() => new NotImplementedException();
|
internal readonly bool isVertex;
|
||||||
|
|
||||||
|
public bool IsVertex => isVertex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 刷新点的位置,即移动点。当该点是某个几何体的从动点时
|
||||||
|
/// (即点坐标由几何体其他点约束或点参数已经在创建几何体时定义)
|
||||||
|
/// 请不要再次进行定义,程序将自行忽略此处的代码。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="tick">当前游戏刻</param>
|
||||||
|
public virtual void Update(uint tick) {}
|
||||||
|
|
||||||
public bool IsInGeometry(IPlainGeometry geo)
|
public bool IsInGeometry(IPlainGeometry geo)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
using StgSharp.Control;
|
||||||
|
using StgSharp.Math;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace StgSharp.Geometries
|
||||||
|
{
|
||||||
|
public class Polygon4 : IPlainGeometry
|
||||||
|
{
|
||||||
|
internal Point vertex01;
|
||||||
|
internal Point vertex02;
|
||||||
|
internal Point vertex03;
|
||||||
|
internal Point vertex04;
|
||||||
|
|
||||||
|
internal readonly GetLocationHandler movVertex01Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
internal readonly GetLocationHandler movVertex02Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
internal readonly GetLocationHandler movVertex03Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
internal readonly GetLocationHandler movVertex04Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
|
||||||
|
public override Point RefPoint01 => vertex01;
|
||||||
|
|
||||||
|
public override Point RefPoint02 => vertex02;
|
||||||
|
|
||||||
|
public override Point RefPoint03 => vertex03;
|
||||||
|
|
||||||
|
public GetLocationHandler MovVertex01Operaion { get { return movVertex01Operation; } }
|
||||||
|
public GetLocationHandler MovVertex02Operaion { get { return movVertex02Operation; } }
|
||||||
|
public GetLocationHandler MovVertex03Operaion { get { return movVertex03Operation; } }
|
||||||
|
public GetLocationHandler MovVertex04Operaion { get { return movVertex04Operation; } }
|
||||||
|
|
||||||
|
public override Line[] GetAllSides()
|
||||||
|
{
|
||||||
|
Line[] sides = new Line[4]
|
||||||
|
{
|
||||||
|
new Line(vertex01,vertex02),
|
||||||
|
new Line(vertex02, vertex03),
|
||||||
|
new Line(vertex03, vertex04),
|
||||||
|
new Line(vertex04, vertex01)
|
||||||
|
};
|
||||||
|
|
||||||
|
sides[0] = new Line(vertex01,vertex02);
|
||||||
|
sides[1] = new Line(vertex02,vertex03);
|
||||||
|
sides[2] = new Line(vertex03,vertex04);
|
||||||
|
sides[3] = new Line(vertex04,vertex01);
|
||||||
|
|
||||||
|
return sides;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Plain GetPlain()
|
||||||
|
{
|
||||||
|
return new Plain(this.RefPoint01, this.RefPoint02, this.RefPoint03);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public virtual vec3d MovVertex01(uint tick) => movVertex01Operation.Invoke(tick);
|
||||||
|
|
||||||
|
public virtual vec3d MovVertex02(uint tick) => movVertex01Operation.Invoke(tick);
|
||||||
|
|
||||||
|
public virtual vec3d MovVertex03(uint tick) => movVertex01Operation.Invoke(tick);
|
||||||
|
|
||||||
|
public virtual vec3d MovVertex04(uint tick) => movVertex01Operation.Invoke(tick);
|
||||||
|
|
||||||
|
|
||||||
|
internal override void OnRender(uint tick)
|
||||||
|
{
|
||||||
|
uint nowTick = GameTimeLine.tickCounter._value;
|
||||||
|
this.vertex01._position = RefOrigin._position + movVertex01Operation(nowTick);
|
||||||
|
this.vertex02._position = RefOrigin._position + movVertex02Operation(nowTick);
|
||||||
|
this.vertex03._position = RefOrigin._position + movVertex03Operation(nowTick);
|
||||||
|
this.vertex04._position = RefOrigin._position + movVertex04Operation(nowTick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
using Steamworks;
|
using Steamworks;
|
||||||
using StgSharp.Control;
|
using StgSharp.Control;
|
||||||
using StgSharp.Linear;
|
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -17,77 +16,77 @@ namespace StgSharp.Geometries
|
|||||||
internal Point vertex3;
|
internal Point vertex3;
|
||||||
internal Point vertex4;
|
internal Point vertex4;
|
||||||
internal Point vertex5;
|
internal Point vertex5;
|
||||||
internal RenderMode _renderMode;
|
|
||||||
internal readonly int _vertexCount;
|
internal readonly int _vertexCount;
|
||||||
|
|
||||||
public override Point RefOrigin => _refOrigin;
|
|
||||||
|
|
||||||
public override Point RefPoint01 => vertex1;
|
public override Point RefPoint01 => vertex1;
|
||||||
|
|
||||||
public override Point RefPoint02 => vertex2;
|
public override Point RefPoint02 => vertex2;
|
||||||
|
|
||||||
public override Point RefPoint03 => vertex3;
|
public override Point RefPoint03 => vertex3;
|
||||||
|
|
||||||
public override RenderMode renderMode => throw new NotImplementedException();
|
|
||||||
|
internal GetLocationHandler movP01Operation = default;
|
||||||
|
internal GetLocationHandler movP02Operation = default;
|
||||||
|
internal GetLocationHandler movP03Operation = default;
|
||||||
|
internal GetLocationHandler movP04Operation = default;
|
||||||
|
internal GetLocationHandler movP05Operation = default;
|
||||||
|
|
||||||
|
public GetLocationHandler MovP01Operation { get => movP01Operation; }
|
||||||
|
public GetLocationHandler MovP02Operation { get => movP02Operation; }
|
||||||
|
public GetLocationHandler MovP03Operation { get => movP03Operation; }
|
||||||
|
public GetLocationHandler MovP04Operation { get => movP04Operation; }
|
||||||
|
public GetLocationHandler MovP05Operation { get => movP05Operation; }
|
||||||
|
|
||||||
public virtual vec3d movPoint01(uint tick)
|
public virtual vec3d movPoint01(uint tick)
|
||||||
{
|
{
|
||||||
return movP01Operation.Invoke(GameTimeLine.tickCounter);
|
return movP01Operation.Invoke(GameTimeLine.tickCounter._value);
|
||||||
}
|
}
|
||||||
internal GetLocationHandler movP01Operation = default;
|
|
||||||
public GetLocationHandler MovP01Operation { get => movP01Operation ; }
|
|
||||||
|
|
||||||
public virtual vec3d movPoint02(uint tick)
|
public virtual vec3d movPoint02(uint tick)
|
||||||
{
|
{
|
||||||
return movP02Operation.Invoke(GameTimeLine.tickCounter);
|
return movP02Operation.Invoke(GameTimeLine.tickCounter._value);
|
||||||
}
|
}
|
||||||
internal GetLocationHandler movP02Operation = default;
|
|
||||||
public GetLocationHandler MovP02Operation { get => movP02Operation ; }
|
|
||||||
|
|
||||||
public virtual vec3d movPoint03(uint tick)
|
public virtual vec3d movPoint03(uint tick)
|
||||||
{
|
{
|
||||||
return movP03Operation.Invoke(GameTimeLine.tickCounter);
|
return movP03Operation.Invoke(GameTimeLine.tickCounter._value);
|
||||||
}
|
}
|
||||||
internal GetLocationHandler movP03Operation = default;
|
|
||||||
public GetLocationHandler MovP03Operation { get => movP03Operation; }
|
|
||||||
|
|
||||||
public virtual vec3d movPoint04(uint tick)
|
public virtual vec3d movPoint04(uint tick)
|
||||||
{
|
{
|
||||||
return movP04Operation.Invoke(GameTimeLine.tickCounter);
|
return movP04Operation.Invoke(GameTimeLine.tickCounter._value);
|
||||||
}
|
}
|
||||||
internal GetLocationHandler movP04Operation = default;
|
|
||||||
public GetLocationHandler MovP04Operation { get => movP04Operation; }
|
|
||||||
|
|
||||||
public virtual vec3d movPoint05(uint tick)
|
public virtual vec3d movPoint05(uint tick)
|
||||||
{
|
{
|
||||||
return movP05Operation.Invoke(GameTimeLine.tickCounter);
|
return movP05Operation.Invoke(GameTimeLine.tickCounter._value);
|
||||||
}
|
}
|
||||||
internal GetLocationHandler movP05Operation = default;
|
|
||||||
public GetLocationHandler MovP05Operation { get => movP05Operation; }
|
|
||||||
|
|
||||||
internal override void OnRender(uint tick)
|
internal override void OnRender(uint tick)
|
||||||
{
|
{
|
||||||
|
uint nowTick = tick - BornTime;
|
||||||
}
|
vertex1._position = RefOrigin._position + movPoint01(nowTick);
|
||||||
|
vertex2._position = RefOrigin._position + movPoint02(nowTick);
|
||||||
public override float SetArrayX()
|
vertex3._position = RefOrigin._position + movPoint03(nowTick);
|
||||||
{
|
vertex4._position = RefOrigin._position + movPoint04(nowTick);
|
||||||
throw new NotImplementedException();
|
vertex5._position = RefOrigin._position + movPoint05(nowTick);
|
||||||
}
|
|
||||||
|
|
||||||
public override float SetArrayY()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return new Line[5]
|
||||||
|
{
|
||||||
|
new Line(vertex1,vertex2),
|
||||||
|
new Line(vertex2,vertex3),
|
||||||
|
new Line(vertex3,vertex4),
|
||||||
|
new Line(vertex4,vertex5),
|
||||||
|
new Line(vertex5,vertex1)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Plain GetPlain()
|
public override Plain GetPlain()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return new Plain(vertex1,vertex2,vertex3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using StgSharp.Control;
|
using StgSharp.Control;
|
||||||
using StgSharp.Linear;
|
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -7,173 +6,40 @@ using System.Text;
|
|||||||
|
|
||||||
namespace StgSharp.Geometries
|
namespace StgSharp.Geometries
|
||||||
{
|
{
|
||||||
public class Rectangle : IPlainGeometry
|
public class Rectangle : Polygon4
|
||||||
{
|
{
|
||||||
internal Point _basePoint;
|
internal Point center;
|
||||||
internal Point _center;
|
|
||||||
internal Point _vertex1;
|
|
||||||
internal Point _vertex2;
|
|
||||||
internal RenderMode _renderMode;
|
|
||||||
internal readonly uint bornTick;
|
|
||||||
|
|
||||||
public override sealed Point RefOrigin => _basePoint;
|
public override sealed Point RefPoint01=>center;
|
||||||
public override sealed Point RefPoint=>_center;
|
|
||||||
|
|
||||||
public override sealed Point RefVec01 => _vertex1;
|
public override sealed Point RefPoint02 => vertex01;
|
||||||
|
|
||||||
public override sealed Point RefVec02 => _vertex2;
|
public override sealed Point RefPoint03 => vertex02;
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
|
||||||
|
|
||||||
public Rectangle(uint bornTime) : base(bornTime)
|
|
||||||
{
|
|
||||||
bornTick = bornTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Rectangle(Counter<uint> tickCounter) : base(tickCounter)
|
|
||||||
{
|
|
||||||
bornTick = tickCounter._value;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override sealed void OnRender(uint tick)
|
|
||||||
{
|
|
||||||
tick-=bornTick;
|
|
||||||
CalcVec01(tick);
|
|
||||||
switch (renderMode)
|
|
||||||
{
|
|
||||||
case RenderMode.BasePoint:
|
|
||||||
CalcVec02(_basePoint._position,tick);
|
|
||||||
CalcVec03(_basePoint._position,tick);
|
|
||||||
break;
|
|
||||||
case RenderMode.RefPoint:
|
|
||||||
CalcVec02(_center._position, tick);
|
|
||||||
CalcVec03(_center._position, tick);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override sealed float SetArrayX()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override sealed float SetArrayY()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override void CalcVec01(uint tick)
|
|
||||||
{
|
|
||||||
_center._position = _basePoint._position + MovCenter(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 计算长方形第一条对角线的一半的矢量表示
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="vec">作为参考的矢量,根据计算模式可以分为参考原点
|
|
||||||
/// 和参考中心点两种</param>
|
|
||||||
/// <param name="tick">当前游戏刻</param>
|
|
||||||
internal override void CalcVec02(vec3d vec, uint tick)
|
|
||||||
{
|
|
||||||
_vertex1._position = vec + UpdateCTC1(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 计算长方形第二条对角线一半的矢量表示
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="vec">作为参考的矢量,根据计算模式可以分为参考原点
|
|
||||||
/// 和参考中心点两种</param>
|
|
||||||
/// <param name="tick">当前游戏刻</param>
|
|
||||||
/// <exception cref="ArgumentException">计算出的第二条对角线长与第一条不相等</exception>
|
|
||||||
internal override void CalcVec03(vec3d vec, uint tick)
|
|
||||||
{
|
|
||||||
_vertex2._position = vec + UpdateCTC2(tick);
|
|
||||||
if (_vertex1._position.GetLength()
|
|
||||||
== _vertex2._position.GetLength())
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Cannot form a triangle, " +
|
|
||||||
"two crossing lines are not equal!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
internal sealed override void CalcVec04(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec05(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec06(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec07(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec08(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec09(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec10(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec11(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec12(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec13(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec14(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec15(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec16(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 计算中心点相对于参考原点的位移
|
/// 计算中心点相对于参考原点的位移
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tick">当前游戏刻</param>
|
/// <param name="tick">当前游戏刻</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual vec3d MovCenter(uint tick)=>default(vec3d);
|
public virtual vec3d MovCenter(uint tick) => default(vec3d);
|
||||||
|
|
||||||
/// <summary>
|
public sealed override vec3d MovVertex03(uint tick)
|
||||||
/// 计算第一个顶点相对于参考点的位移,可以是中心点,也可以是参考原点
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tick"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public virtual vec3d UpdateCTC1(uint tick) => default(vec3d);
|
|
||||||
|
|
||||||
public virtual vec3d UpdateCTC2(uint tick) => default(vec3d);
|
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
|
||||||
{
|
{
|
||||||
|
return this.center._position * 2 - this.vertex01._position;
|
||||||
Line[] sides = new Line[4]
|
|
||||||
{
|
|
||||||
new Line(GameTimeLine.tickCounter),
|
|
||||||
new Line(GameTimeLine.tickCounter),
|
|
||||||
new Line(GameTimeLine.tickCounter),
|
|
||||||
new Line(GameTimeLine.tickCounter),
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
sides[0]._basePoint = this._vertex1;
|
|
||||||
sides[0]._beginPoint = this._vertex1;
|
|
||||||
sides[0]._endPoint = this._vertex2;
|
|
||||||
|
|
||||||
sides[1]._basePoint = this._vertex2;
|
|
||||||
sides[1]._beginPoint = this._vertex2;
|
|
||||||
sides[1]._endPoint = new Point() { _position = GetVertex3(GameTimeLine.tickCounter) };
|
|
||||||
sides[1].movEnd += this.GetVertex3;
|
|
||||||
|
|
||||||
sides[2]._basePoint = sides[1]._endPoint;
|
|
||||||
sides[2]._beginPoint = sides[2]._basePoint;
|
|
||||||
sides[2]._endPoint = new Point() { _position = this.GetVertex4(GameTimeLine.tickCounter) };
|
|
||||||
sides[2].movEnd += this.GetVertex4;
|
|
||||||
|
|
||||||
sides[3]._beginPoint = sides[2]._endPoint;
|
|
||||||
sides[3]._endPoint = this._vertex1;
|
|
||||||
|
|
||||||
return sides;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Plain GetPlain()
|
public sealed override vec3d MovVertex04(uint tick)
|
||||||
{
|
{
|
||||||
return new Plain(this._center, this._vertex1,this._vertex2);
|
return this.center._position * 2 - this.vertex02._position;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected vec3d GetVertex3(Counter<uint> tick)
|
internal override sealed void OnRender(uint tick)
|
||||||
{
|
{
|
||||||
return 2 * this._center._position - this._vertex1._position;
|
tick-=bornTick;
|
||||||
|
this.MovCenter(tick);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected vec3d GetVertex4(Counter<uint> tick)
|
|
||||||
{
|
|
||||||
return 2 * this._center._position - this._vertex2._position;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using StgSharp;
|
using StgSharp;
|
||||||
using StgSharp.Linear;
|
|
||||||
using StgSharp.Math;
|
using StgSharp.Math;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -10,119 +9,54 @@ namespace StgSharp.Geometries
|
|||||||
{
|
{
|
||||||
public class Triangle :IPlainGeometry
|
public class Triangle :IPlainGeometry
|
||||||
{
|
{
|
||||||
internal Point _basePoint;
|
internal Point vertex1;
|
||||||
internal Point _vertex1;
|
internal Point vertex2;
|
||||||
internal Point _vertex2;
|
internal Point vertex3;
|
||||||
internal Point _vertex3;
|
internal GetLocationHandler movVertex01Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal RenderMode _renderMode;
|
internal GetLocationHandler movVertex02Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
internal readonly uint bornTick;
|
internal GetLocationHandler movVertex03Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||||
|
|
||||||
public override sealed Point RefOrigin => _basePoint;
|
|
||||||
|
|
||||||
public override sealed Point RefPoint=>_vertex1;
|
|
||||||
|
|
||||||
public override sealed Point RefVec01 => _vertex2;
|
|
||||||
|
|
||||||
public override sealed Point RefVec02 => _vertex3;
|
|
||||||
|
|
||||||
public override RenderMode renderMode => _renderMode;
|
|
||||||
|
|
||||||
public Triangle(uint bornTime) : base(bornTime)
|
|
||||||
{
|
|
||||||
bornTick = bornTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Triangle(Counter<uint> tickCounter) : base(tickCounter)
|
|
||||||
{
|
|
||||||
bornTick = tickCounter._value;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override void CalcVec01(uint tick)
|
|
||||||
{
|
|
||||||
_vertex1._position = _basePoint._position+ MovBegin(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override void CalcVec02(vec3d vec, uint tick)
|
|
||||||
{
|
|
||||||
_vertex2._position = vec + CalcSide1(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override void CalcVec03(vec3d vec, uint tick)
|
|
||||||
{
|
|
||||||
_vertex3._position = vec + CalcSide2(tick);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
internal sealed override void CalcVec04(vec3d vec, uint tick) => throw new UnusedVertexException();
|
public override sealed Point RefPoint01=> vertex1;
|
||||||
internal sealed override void CalcVec05(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec06(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec07(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec08(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec09(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec10(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec11(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec12(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec13(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec14(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec15(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
internal sealed override void CalcVec16(vec3d vec, uint tick) => throw new UnusedVertexException();
|
|
||||||
|
|
||||||
public virtual vec3d MovBegin(uint tick) => default(vec3d);
|
public override sealed Point RefPoint02 => vertex2;
|
||||||
|
|
||||||
public virtual vec3d CalcSide1(uint tick)=> default(vec3d);
|
public override sealed Point RefPoint03 => vertex3;
|
||||||
|
|
||||||
public virtual vec3d CalcSide2(uint tick) => default(vec3d);
|
public GetLocationHandler MovVertex01Operation => this.movVertex01Opearion;
|
||||||
|
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
|
||||||
|
public GetLocationHandler MovVertex03Operation => this.movVertex03Opearion;
|
||||||
|
|
||||||
|
public virtual vec3d MovVertex01(uint tick) => movVertex01Opearion.Invoke(tick);
|
||||||
|
|
||||||
|
public virtual vec3d MovVertex02(uint tick) => movVertex02Opearion.Invoke(tick);
|
||||||
|
|
||||||
|
public virtual vec3d MovVertex03(uint tick) => movVertex03Opearion.Invoke(tick);
|
||||||
|
|
||||||
internal override sealed void OnRender(uint tick)
|
internal override sealed void OnRender(uint tick)
|
||||||
{
|
{
|
||||||
CalcVec01(tick);
|
tick -= this.bornTick;
|
||||||
switch (_renderMode)
|
vertex1._position = RefOrigin._position + MovVertex01(tick);
|
||||||
{
|
vertex2._position = RefOrigin._position + MovVertex02(tick);
|
||||||
case RenderMode.BasePoint:
|
vertex3._position = RefOrigin._position + MovVertex03(tick);
|
||||||
CalcVec02(RefOrigin._position,tick);
|
|
||||||
CalcVec03(RefOrigin._position,tick);
|
|
||||||
break;
|
|
||||||
case RenderMode.RefPoint:
|
|
||||||
CalcVec02(_vertex1._position,tick);
|
|
||||||
CalcVec03(_vertex1._position,tick);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float SetArrayX()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override float SetArrayY()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Line[] GetAllSides()
|
public override Line[] GetAllSides()
|
||||||
{
|
{
|
||||||
Line[] sides = new Line[3];
|
Line[] sides = new Line[3]
|
||||||
|
{
|
||||||
sides[0]._beginPoint = _vertex1;
|
new Line(vertex1,vertex2),
|
||||||
sides[0]._basePoint = _vertex1;
|
new Line(vertex2,vertex3),
|
||||||
sides[0]._endPoint = _vertex2;
|
new Line(vertex3,vertex1)
|
||||||
|
};
|
||||||
sides[1]._basePoint = _vertex2;
|
|
||||||
sides[1]._beginPoint = _vertex2;
|
|
||||||
sides[1]._endPoint = _vertex3;
|
|
||||||
|
|
||||||
sides[2]._basePoint = _vertex3;
|
|
||||||
sides[2]._beginPoint = _vertex3;
|
|
||||||
sides[2]._endPoint = _vertex1;
|
|
||||||
|
|
||||||
return sides;
|
return sides;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Plain GetPlain()
|
public override Plain GetPlain()
|
||||||
{
|
{
|
||||||
return new Plain(this._vertex1,this._vertex2,this._vertex3);
|
return new Plain(this.vertex1,this.vertex2,this.vertex3);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,13 +40,13 @@ namespace StgSharp
|
|||||||
}
|
}
|
||||||
public Pool( Geometries.Rectangle area)
|
public Pool( Geometries.Rectangle area)
|
||||||
{
|
{
|
||||||
vec3d vec = area._vertex1._position - area._vertex2._position;
|
vec3d vec = area.vertex01._position - area.vertex02._position;
|
||||||
if ((vec.X==0||vec.Y==0)&&vec.Z==0)
|
if ((vec.X==0||vec.Y==0)&&vec.Z==0)
|
||||||
{
|
{
|
||||||
Line[] barders = area.GetAllSides();
|
Line[] barders = area.GetAllSides();
|
||||||
if (area._vertex1.X>0)
|
if (area.vertex01.X>0)
|
||||||
{
|
{
|
||||||
if (area._vertex1.Y>0)
|
if (area.vertex01.Y>0)
|
||||||
{
|
{
|
||||||
topBoader = barders[3];
|
topBoader = barders[3];
|
||||||
rightBoader = barders[0];
|
rightBoader = barders[0];
|
||||||
@@ -63,7 +63,7 @@ namespace StgSharp
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (area._vertex1.Y > 0)
|
if (area.vertex01.Y > 0)
|
||||||
{
|
{
|
||||||
topBoader = barders[3];
|
topBoader = barders[3];
|
||||||
rightBoader = barders[0];
|
rightBoader = barders[0];
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -4,35 +4,65 @@
|
|||||||
<name>StgSharp</name>
|
<name>StgSharp</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
<member name="P:StgSharp.Entity.CollisionSensor">
|
<member name="P:StgSharp.IEntity.CollisionSensor">
|
||||||
<summary>
|
<summary>
|
||||||
A sensor used for cheking out if a bullet hit a player or something else
|
A sensor used for cheking out if a bullet hit a player or something else
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Entity.Location">
|
<member name="P:StgSharp.IEntity.Location">
|
||||||
<summary>
|
<summary>
|
||||||
A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
|
A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Entity.X">
|
<member name="P:StgSharp.IEntity.X">
|
||||||
<summary>
|
<summary>
|
||||||
X position of an enenmy entity
|
X position of an enenmy entity
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Entity.Y">
|
<member name="P:StgSharp.IEntity.Y">
|
||||||
<summary>
|
<summary>
|
||||||
Y position of an enemy entity
|
Y position of an enemy entity
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:StgSharp.Geometries.RenderMode.BasePoint">
|
<member name="T:StgSharp.Geometries.UnusedVertexException">
|
||||||
<summary>
|
<summary>
|
||||||
坐标点将基于参考原点构建
|
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:StgSharp.Geometries.RenderMode.RefPoint">
|
<member name="T:StgSharp.Geometries.GetLocationHandler">
|
||||||
<summary>
|
<summary>
|
||||||
坐标点将基于参考起点构建
|
计算位移失量,需要手动输入游戏刻以提供时间数据
|
||||||
</summary>
|
</summary>
|
||||||
|
<param name="tickCounter"></param>
|
||||||
|
<returns>表示位移量的三维矢量</returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:StgSharp.Geometries.IPlainGeometry">
|
||||||
|
<summary>
|
||||||
|
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:StgSharp.Geometries.Parallelogram.MovVertex03(System.UInt32)">
|
||||||
|
<summary>
|
||||||
|
移动平行四边形的第三个顶点,是一个多余的方法,调用会引发多余变量异常
|
||||||
|
</summary>
|
||||||
|
<param name="tick">当前游戏刻</param>
|
||||||
|
<returns></returns>
|
||||||
|
<exception cref="T:StgSharp.Geometries.UnusedVertexException">几何体过定义</exception>
|
||||||
|
</member>
|
||||||
|
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
|
||||||
|
<summary>
|
||||||
|
刷新点的位置,即移动点。当该点是某个几何体的从动点时
|
||||||
|
(即点坐标由几何体其他点约束或点参数已经在创建几何体时定义)
|
||||||
|
请不要再次进行定义,程序将自行忽略此处的代码。
|
||||||
|
</summary>
|
||||||
|
<param name="tick">当前游戏刻</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:StgSharp.Geometries.Rectangle.MovCenter(System.UInt32)">
|
||||||
|
<summary>
|
||||||
|
计算中心点相对于参考原点的位移
|
||||||
|
</summary>
|
||||||
|
<param name="tick">当前游戏刻</param>
|
||||||
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.colum2,StgSharp.Math.vec2d)">
|
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.colum2,StgSharp.Math.vec2d)">
|
||||||
<summary>
|
<summary>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
b06fbbdaa0e28e28634094c37b24ee8c2c2f1201
|
0bd409a23d12a7e03a996538d35e30898336817d
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -4,35 +4,65 @@
|
|||||||
<name>StgSharp</name>
|
<name>StgSharp</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
<member name="P:StgSharp.Entity.CollisionSensor">
|
<member name="P:StgSharp.IEntity.CollisionSensor">
|
||||||
<summary>
|
<summary>
|
||||||
A sensor used for cheking out if a bullet hit a player or something else
|
A sensor used for cheking out if a bullet hit a player or something else
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Entity.Location">
|
<member name="P:StgSharp.IEntity.Location">
|
||||||
<summary>
|
<summary>
|
||||||
A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
|
A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Entity.X">
|
<member name="P:StgSharp.IEntity.X">
|
||||||
<summary>
|
<summary>
|
||||||
X position of an enenmy entity
|
X position of an enenmy entity
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="P:StgSharp.Entity.Y">
|
<member name="P:StgSharp.IEntity.Y">
|
||||||
<summary>
|
<summary>
|
||||||
Y position of an enemy entity
|
Y position of an enemy entity
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:StgSharp.Geometries.RenderMode.BasePoint">
|
<member name="T:StgSharp.Geometries.UnusedVertexException">
|
||||||
<summary>
|
<summary>
|
||||||
坐标点将基于参考原点构建
|
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:StgSharp.Geometries.RenderMode.RefPoint">
|
<member name="T:StgSharp.Geometries.GetLocationHandler">
|
||||||
<summary>
|
<summary>
|
||||||
坐标点将基于参考起点构建
|
计算位移失量,需要手动输入游戏刻以提供时间数据
|
||||||
</summary>
|
</summary>
|
||||||
|
<param name="tickCounter"></param>
|
||||||
|
<returns>表示位移量的三维矢量</returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:StgSharp.Geometries.IPlainGeometry">
|
||||||
|
<summary>
|
||||||
|
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:StgSharp.Geometries.Parallelogram.MovVertex03(System.UInt32)">
|
||||||
|
<summary>
|
||||||
|
移动平行四边形的第三个顶点,是一个多余的方法,调用会引发多余变量异常
|
||||||
|
</summary>
|
||||||
|
<param name="tick">当前游戏刻</param>
|
||||||
|
<returns></returns>
|
||||||
|
<exception cref="T:StgSharp.Geometries.UnusedVertexException">几何体过定义</exception>
|
||||||
|
</member>
|
||||||
|
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
|
||||||
|
<summary>
|
||||||
|
刷新点的位置,即移动点。当该点是某个几何体的从动点时
|
||||||
|
(即点坐标由几何体其他点约束或点参数已经在创建几何体时定义)
|
||||||
|
请不要再次进行定义,程序将自行忽略此处的代码。
|
||||||
|
</summary>
|
||||||
|
<param name="tick">当前游戏刻</param>
|
||||||
|
</member>
|
||||||
|
<member name="M:StgSharp.Geometries.Rectangle.MovCenter(System.UInt32)">
|
||||||
|
<summary>
|
||||||
|
计算中心点相对于参考原点的位移
|
||||||
|
</summary>
|
||||||
|
<param name="tick">当前游戏刻</param>
|
||||||
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.colum2,StgSharp.Math.vec2d)">
|
<member name="M:StgSharp.Math.VectorCalc.multiple(StgSharp.Math.colum2,StgSharp.Math.vec2d)">
|
||||||
<summary>
|
<summary>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user