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;
|
||||
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