daily update on 20230301 by nitload youmu, file struct cahnged and more vec func added
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp_Geometry
|
||||
{
|
||||
internal class PointOnLine : Point
|
||||
{
|
||||
private Point _beginPoint;
|
||||
|
||||
public Point BeginPoint
|
||||
{
|
||||
get { return _beginPoint; }
|
||||
set { _beginPoint = value; }
|
||||
}
|
||||
|
||||
private Point _endPoint;
|
||||
|
||||
public Point EndPoint
|
||||
{
|
||||
get { return _endPoint; }
|
||||
set { _endPoint = value; }
|
||||
}
|
||||
|
||||
private float _angle;
|
||||
|
||||
public float Angle
|
||||
{
|
||||
get { return _angle; }
|
||||
set { _angle = value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
private float rate;
|
||||
|
||||
public PointOnLine(Point beginPoint,Point endPoint,float rate,int number)
|
||||
{
|
||||
_beginPoint = beginPoint;
|
||||
_endPoint = endPoint;
|
||||
|
||||
_angle = (float)(Math.Atan2(endPoint.Y-beginPoint.Y,endPoint.X-beginPoint.Y));
|
||||
|
||||
rate = rate * number;
|
||||
this.Y = beginPoint.Y + rate * (endPoint.Y - beginPoint.Y);
|
||||
this.X = beginPoint.X + rate * (endPoint.X - beginPoint.X);
|
||||
}
|
||||
|
||||
public override void OnRender()
|
||||
{
|
||||
_angle = (float)(Math.Atan2(_endPoint.Y - _beginPoint.Y, _endPoint.X - _beginPoint.Y));
|
||||
|
||||
this.Y = _beginPoint.Y + rate * (_endPoint.Y - _beginPoint.Y);
|
||||
this.X = _beginPoint.X + rate * (_endPoint.X - _beginPoint.X);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user