101 lines
2.7 KiB
C#
101 lines
2.7 KiB
C#
using Steamworks;
|
|
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 RefPoint => _center;
|
|
|
|
public override Point RefVec01 => _beginPoint;
|
|
|
|
public override Point RefVec02 => _endPoint;
|
|
|
|
public override RenderMode renderMode => _renderMode;
|
|
|
|
|
|
|
|
internal sealed override void CalcVec01(uint tick)
|
|
{
|
|
_center._position = _basePoint._position + MoveCenter(tick);
|
|
}
|
|
|
|
internal sealed override void CalcVec02(vec3d vec, uint tick)
|
|
{
|
|
_beginPoint._position = vec + UpdateRadius(tick);
|
|
|
|
}
|
|
internal sealed override void CalcVec03(vec3d vec, uint tick)
|
|
{
|
|
_endPoint._position = vec + UpdateAngle(tick);
|
|
}
|
|
|
|
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;
|
|
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 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);
|
|
}
|
|
}
|
|
}
|