83 lines
2.4 KiB
C#
83 lines
2.4 KiB
C#
using StgSharp.Linear;
|
|
using StgSharp.Math;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
|
|
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;
|
|
|
|
public Arc(uint bornTime) : base(bornTime)
|
|
{
|
|
bornTick = bornTime;
|
|
}
|
|
|
|
public Arc(Counter<uint> tickCounter) : base(tickCounter)
|
|
{
|
|
bornTick = tickCounter._value;
|
|
}
|
|
|
|
public override Point RefOrigin => _basePoint;
|
|
|
|
public override Point RefPoint01 => _center;
|
|
|
|
public override Point RefPoint02 => _beginPoint;
|
|
|
|
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;
|
|
|
|
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();
|
|
}
|
|
|
|
public override Line[] GetAllSides() => throw new NotImplementedException();
|
|
|
|
public override Plain GetPlain()
|
|
{
|
|
return new Plain(this._center,this._beginPoint,this._endPoint);
|
|
}
|
|
}
|
|
}
|