public static ExtraPoint[] Linear(ExtraPoint p0, ExtraPoint p1, int digit) { double t = 0; string plus_str = ("1").PadLeft(digit, '0'); double plus = Convert.ToDouble($@"0.{plus_str}"); List <ExtraPoint> output = new List <ExtraPoint>(); for (; t <= 1; t += plus) { //x point double x = (Convert.ToDouble(p0.X + (p1.X - p0.X)) * t); //x point double y = (Convert.ToDouble(p0.Y + (p1.Y - p0.Y)) * t); output.Add(new ExtraPoint(x, y)); } return(output.ToArray()); }
public static ExtraPoint[] Quadratic(ExtraPoint p0, ExtraPoint p1, ExtraPoint p2, int digit) { double t = 0; string plus_str = ("1").PadLeft(digit, '0'); double plus = Convert.ToDouble($@"0.{plus_str}"); List <ExtraPoint> output = new List <ExtraPoint>(); for (; t <= 1; t += plus) { //x point double x = (Convert.ToDouble(System.Math.Pow((1 - t), 2) * p0.X + 2 * t * (1 - t) * p1.X + System.Math.Pow(t, 2) * p2.X)); //x point double y = (Convert.ToDouble(System.Math.Pow((1 - t), 2) * p0.Y + 2 * t * (1 - t) * p1.Y + System.Math.Pow(t, 2) * p2.Y)); output.Add(new ExtraPoint(x, y)); } return(output.ToArray()); }