private class ContinuousSlope
{
private Vector2[] Points = new Vector2[ 2 ];
public float Slope { get; private set; }
public bool SlopeChanged = false;
public ContinuousSlope()
{
Points[ 0 ] = new Vector2();
Points[ 1 ] = new Vector2();
}
public void FeedPoint( Vector2 P )
{
Points[ 1 ] = Points[ 0 ];
Points[ 0 ] = P;
float OSlope = Slope;
Slope = ( A.Y - B.Y ) / ( A.X - B.X );
SlopeChanged = ( Slope < 0 && 0 < OSlope ) || ( Slope < 0 && 0 < OSlope );
}
Vector2 A { get { return Points[ 0 ]; } }
Vector2 B { get { return Points[ 1 ]; } }
}