daily update on 20230418 by nitload youmu.
rewrite of geometry is completed. ready for release of ver0.1.0
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using StgSharp.Linear;
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
@@ -10,73 +9,38 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class Arc : IPlainGeometry
|
||||
{
|
||||
internal Point _basePoint;
|
||||
internal Point _center;
|
||||
internal Point _beginPoint;
|
||||
internal Point _endPoint;
|
||||
internal RenderMode _renderMode;
|
||||
internal readonly uint bornTick;
|
||||
internal Point center;
|
||||
internal Point beginPoint;
|
||||
internal Point endPoint;
|
||||
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
public Arc(uint bornTime) : base(bornTime)
|
||||
{
|
||||
bornTick = bornTime;
|
||||
}
|
||||
public override Point RefPoint01 => center;
|
||||
|
||||
public Arc(Counter<uint> tickCounter) : base(tickCounter)
|
||||
{
|
||||
bornTick = tickCounter._value;
|
||||
}
|
||||
public override Point RefPoint02 => beginPoint;
|
||||
|
||||
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 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;
|
||||
public virtual vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
{
|
||||
tick-=bornTick;
|
||||
_center._position = _basePoint._position + MoveCenter(tick);
|
||||
switch (_renderMode)
|
||||
{
|
||||
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();
|
||||
tick-= bornTick;
|
||||
center._position = refOrigin._position + MoveCenter(tick);
|
||||
beginPoint._position = refOrigin._position + MovBegin(tick);
|
||||
endPoint._position = refOrigin._position + MovEnd(tick);
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides() => throw new NotImplementedException();
|
||||
|
||||
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.Collections.Generic;
|
||||
using System.Text;
|
||||
@@ -8,71 +7,37 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class Circle : IPlainGeometry
|
||||
{
|
||||
internal Point _baseCenter;
|
||||
internal Point _center;
|
||||
internal Point _pointOnCircle;
|
||||
internal Point _pointOnPlain;
|
||||
internal RenderMode _renderMode;
|
||||
internal readonly uint bornTick;
|
||||
internal Point center;
|
||||
internal Point pointOnCircle;
|
||||
internal Point pointOnPlain;
|
||||
internal GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
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)
|
||||
{
|
||||
bornTick = bornTime;
|
||||
}
|
||||
public virtual vec3d UpdateRadius(uint tick) => movBeginOperation.Invoke(tick);
|
||||
|
||||
public Circle(Counter<uint> tickCounter) : base(tickCounter)
|
||||
{
|
||||
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 virtual vec3d UpdatePlain(uint tick) => movEndOperation.Invoke(tick);
|
||||
|
||||
public override Plain GetPlain()
|
||||
{
|
||||
return new Plain(_center,_pointOnCircle,_pointOnPlain);
|
||||
return new Plain(center, pointOnCircle, pointOnPlain);
|
||||
}
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
{
|
||||
tick-=bornTick;
|
||||
_center._position = MoveCenter(tick);
|
||||
switch (_renderMode)
|
||||
{
|
||||
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;
|
||||
}
|
||||
center._position = refOrigin._position + MoveCenter(tick);
|
||||
pointOnCircle._position = refOrigin._position + UpdateRadius(tick);
|
||||
pointOnPlain._position = refOrigin._position + UpdatePlain(tick);
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
|
||||
+10
-1
@@ -11,5 +11,14 @@ namespace StgSharp.Geometries
|
||||
/// </summary>
|
||||
/// <param name="tickCounter"></param>
|
||||
/// <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.Collections.Generic;
|
||||
using System.Text;
|
||||
@@ -12,9 +11,10 @@ namespace StgSharp.Geometries
|
||||
/// </summary>
|
||||
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 RefPoint02{ get; }
|
||||
public abstract Point RefPoint03{ get; }
|
||||
@@ -34,10 +34,6 @@ namespace StgSharp.Geometries
|
||||
|
||||
|
||||
internal abstract void OnRender(uint tick);
|
||||
|
||||
public abstract RenderMode renderMode { get; }
|
||||
public abstract float SetArrayX();
|
||||
public abstract float SetArrayY();
|
||||
|
||||
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 StgSharp;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Linear;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,83 +10,37 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class Line:IPlainGeometry
|
||||
{
|
||||
internal Point _basePoint = default ;
|
||||
internal Point _beginPoint = default ;
|
||||
internal Point _endPoint = default;
|
||||
internal Point basePoint = default ;
|
||||
internal Point beginPoint = default ;
|
||||
internal Point endPoint = default;
|
||||
internal GetLocationHandler movBegin;
|
||||
internal GetLocationHandler movEnd;
|
||||
internal RenderMode _renderMode;
|
||||
internal readonly uint bornTick;
|
||||
|
||||
public override Point RefOrigin => _basePoint;
|
||||
|
||||
public override Point RefPoint => _beginPoint;
|
||||
|
||||
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 override Point RefPoint01 => beginPoint;
|
||||
public override Point RefPoint02 => endPoint;
|
||||
public override Point RefPoint03 => default;
|
||||
|
||||
public Line(Point begin, Point end)
|
||||
{
|
||||
this._beginPoint = begin;
|
||||
this._endPoint = end;
|
||||
this.beginPoint = begin;
|
||||
this.endPoint = end;
|
||||
}
|
||||
|
||||
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)
|
||||
=> movBegin.Invoke( GameTimeLine.tickCounter);
|
||||
=> movBegin.Invoke(tick);
|
||||
|
||||
//计算线重点的方法,通过对线的派生的重写实现功能
|
||||
public virtual vec3d MoveEndPoint(uint tick)
|
||||
=> movEnd.Invoke( GameTimeLine.tickCounter);
|
||||
=> movEnd.Invoke(tick);
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
{
|
||||
tick -= bornTick;
|
||||
CalcVec01(tick);
|
||||
switch (_renderMode)
|
||||
{
|
||||
case RenderMode.BasePoint:
|
||||
CalcVec02(_basePoint._position, tick);
|
||||
break;
|
||||
case RenderMode.RefPoint:
|
||||
CalcVec02(_beginPoint._position, tick);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
beginPoint._position = refOrigin._position + MoveBeginPoint(tick);
|
||||
endPoint._position = refOrigin._position + MoveEndPoint(tick);
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Linear;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,151 +6,48 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
internal class Parallelogram : IPlainGeometry
|
||||
internal class Parallelogram : Polygon4
|
||||
{
|
||||
internal Point _basePoint;
|
||||
internal Point _center;
|
||||
internal Point _vertex1;
|
||||
internal Point _vertex2;
|
||||
internal RenderMode _renderMode;
|
||||
internal readonly uint bornTick;
|
||||
internal Point center;
|
||||
|
||||
public override sealed Point RefOrigin => _basePoint;
|
||||
public override sealed Point RefPoint => _center;
|
||||
public override sealed Point RefPoint01 => 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 Parallelogram(uint bornTime) : base(bornTime)
|
||||
public virtual vec3d MovCenter(uint tick)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
//计算第一个顶点的位移,存在相对中心位移和相对参考原点位移两种模式
|
||||
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;
|
||||
uint nowTick = GameTimeLine.tickCounter._value;
|
||||
this.vertex01._position = RefOrigin._position + movVertex01Operation(nowTick);
|
||||
this.vertex02._position = RefOrigin._position + movVertex02Operation(nowTick);
|
||||
this.vertex03._position = 2 * center._position - vertex01._position;
|
||||
this.vertex04._position = 2 * center._position - vertex02._position;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public unsafe class Plain
|
||||
{
|
||||
internal vec3d origin;
|
||||
internal vec3d vec1;
|
||||
internal vec3d vec2;
|
||||
|
||||
internal vec3d plainParameter;
|
||||
internal readonly float d = -1;
|
||||
|
||||
public Plain(vec3d o, vec3d v1, vec3d v2)
|
||||
{
|
||||
this.origin = o;
|
||||
this.vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
|
||||
this.vec2 = v2 - vec1 * (v2.X / v1.X); //计算平面在yz平面上的方向投影
|
||||
|
||||
//|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和对应的方向矢量计算plainParameter.X和plainParameter.Y
|
||||
plainParameter.X = vec1.X * (vec1.Z / plainParameter.Z);
|
||||
plainParameter.Y = vec2.Y * (vec2.Z / plainParameter.Z);
|
||||
|
||||
plainParameter.X = 1 / plainParameter.X;
|
||||
plainParameter.Y = 1 / plainParameter.Y;
|
||||
plainParameter.Z = 1 / plainParameter.Z;
|
||||
}
|
||||
|
||||
public Plain(Point p1, Point p2, Point p3)
|
||||
{
|
||||
vec3d origin = p1._position;
|
||||
vec3d v1 = p2._position - origin;
|
||||
vec3d v2 = p3._position - origin;
|
||||
|
||||
|
||||
vec1 = v1 - v2 * (v1.Y / v2.Y); //计算平面在xz平面上的方向投影
|
||||
vec2 = v2 - vec1 * (v2.X / v1.X); //计算平面在yz平面上的方向投影
|
||||
|
||||
//|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和对应的方向矢量计算plainParameter.X和plainParameter.Y
|
||||
plainParameter.X = vec1.X * (vec1.Z / plainParameter.Z);
|
||||
plainParameter.Y = vec2.Y * (vec2.Z / plainParameter.Z);
|
||||
|
||||
plainParameter.X = 1 / plainParameter.X;
|
||||
plainParameter.Y = 1 / plainParameter.Y;
|
||||
plainParameter.Z = 1 / plainParameter.Z;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -9,7 +9,7 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class Point: INode<Point>
|
||||
public class Point : INode<Point>
|
||||
{
|
||||
|
||||
internal vec3d _position;
|
||||
@@ -24,7 +24,17 @@ namespace StgSharp.Geometries
|
||||
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)
|
||||
{
|
||||
|
||||
@@ -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 StgSharp.Control;
|
||||
using StgSharp.Linear;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,77 +16,77 @@ namespace StgSharp.Geometries
|
||||
internal Point vertex3;
|
||||
internal Point vertex4;
|
||||
internal Point vertex5;
|
||||
internal RenderMode _renderMode;
|
||||
internal readonly int _vertexCount;
|
||||
|
||||
public override Point RefOrigin => _refOrigin;
|
||||
|
||||
public override Point RefPoint01 => vertex1;
|
||||
|
||||
public override Point RefPoint02 => vertex2;
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override float SetArrayX()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override float SetArrayY()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
uint nowTick = tick - BornTime;
|
||||
vertex1._position = RefOrigin._position + movPoint01(nowTick);
|
||||
vertex2._position = RefOrigin._position + movPoint02(nowTick);
|
||||
vertex3._position = RefOrigin._position + movPoint03(nowTick);
|
||||
vertex4._position = RefOrigin._position + movPoint04(nowTick);
|
||||
vertex5._position = RefOrigin._position + movPoint05(nowTick);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return new Plain(vertex1,vertex2,vertex3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Linear;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -7,173 +6,40 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class Rectangle : IPlainGeometry
|
||||
public class Rectangle : Polygon4
|
||||
{
|
||||
internal Point _basePoint;
|
||||
internal Point _center;
|
||||
internal Point _vertex1;
|
||||
internal Point _vertex2;
|
||||
internal RenderMode _renderMode;
|
||||
internal readonly uint bornTick;
|
||||
internal Point center;
|
||||
|
||||
public override sealed Point RefOrigin => _basePoint;
|
||||
public override sealed Point RefPoint=>_center;
|
||||
public override sealed Point RefPoint01=>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>
|
||||
/// <param name="tick">当前游戏刻</param>
|
||||
/// <returns></returns>
|
||||
public virtual vec3d MovCenter(uint tick)=>default(vec3d);
|
||||
public virtual vec3d MovCenter(uint tick) => default(vec3d);
|
||||
|
||||
/// <summary>
|
||||
/// 计算第一个顶点相对于参考点的位移,可以是中心点,也可以是参考原点
|
||||
/// </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()
|
||||
public sealed override vec3d MovVertex03(uint tick)
|
||||
{
|
||||
|
||||
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;
|
||||
return this.center._position * 2 - this.vertex01._position;
|
||||
}
|
||||
|
||||
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.Linear;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -10,119 +9,54 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class Triangle :IPlainGeometry
|
||||
{
|
||||
internal Point _basePoint;
|
||||
internal Point _vertex1;
|
||||
internal Point _vertex2;
|
||||
internal Point _vertex3;
|
||||
internal RenderMode _renderMode;
|
||||
internal readonly uint bornTick;
|
||||
|
||||
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 Point vertex1;
|
||||
internal Point vertex2;
|
||||
internal Point vertex3;
|
||||
internal GetLocationHandler movVertex01Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movVertex02Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movVertex03Opearion = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
|
||||
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 override sealed Point RefPoint01=> vertex1;
|
||||
|
||||
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)
|
||||
{
|
||||
CalcVec01(tick);
|
||||
switch (_renderMode)
|
||||
{
|
||||
case RenderMode.BasePoint:
|
||||
CalcVec02(RefOrigin._position,tick);
|
||||
CalcVec03(RefOrigin._position,tick);
|
||||
break;
|
||||
case RenderMode.RefPoint:
|
||||
CalcVec02(_vertex1._position,tick);
|
||||
CalcVec03(_vertex1._position,tick);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
tick -= this.bornTick;
|
||||
vertex1._position = RefOrigin._position + MovVertex01(tick);
|
||||
vertex2._position = RefOrigin._position + MovVertex02(tick);
|
||||
vertex3._position = RefOrigin._position + MovVertex03(tick);
|
||||
|
||||
public override float SetArrayX()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override float SetArrayY()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
{
|
||||
Line[] sides = new Line[3];
|
||||
|
||||
sides[0]._beginPoint = _vertex1;
|
||||
sides[0]._basePoint = _vertex1;
|
||||
sides[0]._endPoint = _vertex2;
|
||||
|
||||
sides[1]._basePoint = _vertex2;
|
||||
sides[1]._beginPoint = _vertex2;
|
||||
sides[1]._endPoint = _vertex3;
|
||||
|
||||
sides[2]._basePoint = _vertex3;
|
||||
sides[2]._beginPoint = _vertex3;
|
||||
sides[2]._endPoint = _vertex1;
|
||||
Line[] sides = new Line[3]
|
||||
{
|
||||
new Line(vertex1,vertex2),
|
||||
new Line(vertex2,vertex3),
|
||||
new Line(vertex3,vertex1)
|
||||
};
|
||||
|
||||
return sides;
|
||||
}
|
||||
|
||||
public override Plain GetPlain()
|
||||
{
|
||||
return new Plain(this._vertex1,this._vertex2,this._vertex3);
|
||||
return new Plain(this.vertex1,this.vertex2,this.vertex3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user