Files
stgsharp/源代码/StgSharp/Geometries/PlainGeometry/Line.cs
T

71 lines
2.0 KiB
C#

using StgSharp.Math;
using System;
using System.Numerics;
namespace StgSharp.Geometries
{
public class Line : PlainGeometry
{
internal Point basePoint;
internal Point beginPoint;
internal Point endPoint;
internal GetLocationHandler movBegin;
internal GetLocationHandler movEnd;
internal override int[] Indices
{
get { throw new Exception(); }
}
public Line(Point begin, Point end)
{
this.beginPoint = begin;
this.endPoint = end;
}
internal Line(Vector4 begin, Vector4 end)
{
beginPoint = new Point(begin);
endPoint = new Point(end);
}
public Line() { }
/// <summary>
/// Move begin side of a line.
/// It is recommended to override this function rather than
/// loading an <see cref="GetLocationHandler"/> with same function.
/// </summary>
/// <param name="tick">Time passed since current line was created.</param>
public virtual vec3d MoveBeginPoint(uint tick)
=> movBegin.Invoke(time);
/// <summary>
/// Move end side of a line.
/// It is recommended to override this function rather than
/// loading an <see cref="GetLocationHandler"/> with same function.
/// </summary>
/// <param name="tick">Time passed since current line was created.</param>
/// <returns></returns>
public virtual vec3d MoveEndPoint(uint tick)
=> movEnd.Invoke(time);
internal override void UpdateCoordinate(uint tick)
{
beginPoint.Position = coordinate.origin + MoveBeginPoint(time);
endPoint.Position = coordinate.origin + MoveEndPoint(time);
}
public override Line[] GetAllSides()
{
throw new NotImplementedException();
}
public override Plain GetPlain()
{
throw new ToUpperDimensionException();
}
}
}