using StgSharp.Controlling;
using StgSharp.Math;
namespace StgSharp.Geometries
{
internal class Parallelogram : Polygon4
{
internal Point center;
public sealed override Point RefPoint0 => center;
public sealed override Point RefPoint1 => new Point(vertexMat.mat.colum0);
public sealed override Point RefPoint2 => new Point(vertexMat.mat.colum1);
internal readonly GetLocationHandler movCenterOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
public GetLocationHandler MovCenterOperation { get { return movCenterOperation; } }
public GetLocationHandler MovVertex01Operation { get { return moveVertex0Operation; } }
public GetLocationHandler MovVertex02Operation { get { return moveVertex1Operation; } }
public virtual Vec3d MovCenter(uint tick)
{
return movCenterOperation.Invoke(tick);
}
///
/// Move the third vertix. this is a useless method for Parallelograms.
///
/// Current time tick
///
/// Geometry overdefined
public sealed override Vec3d MoveVertex2(uint tick)
{
throw new UnusedVertexException();
}
///
/// Move the third vertix. This method is useless for Parallelograms.
///
/// Current time tick
///
/// Geometry overdefined
public sealed override Vec3d MoveVertex3(uint tick)
{
throw new UnusedVertexException();
}
internal sealed override void OnRender(uint tick)
{
uint nowTick = TimeLine.tickCounter._value;
this.vertexMat.Colum0 = RefOrigin.Position + moveVertex0Operation(nowTick);
this.vertexMat.Colum1 = RefOrigin.Position + moveVertex1Operation(nowTick);
this.vertexMat.Colum2 = center.Position * 2 - vertexMat.Colum0;
this.vertexMat.Colum3 = center.Position * 2 - vertexMat.Colum1;
}
}
}