/// <summary> /// a.Count == b.Count !!!!!!! /// </summary> /// <param name="a"></param> /// <param name="b"></param> /// <param name="t"></param> /// <returns></returns> public static Bezier merge(Bezier a, Bezier b, double t = 0.5) { Vec2[] points = new Vec2[a.Count]; for (int i = 0; i < a.Count; ++i) points[i] = t * (a.points[i] + b.points[i]); return new Bezier(points); }
public static Bezier fit(List<Point> points_, int count) { Bezier b = new Bezier(); b.points = new Vec2[count]; b.minY = 10000; b.maxY = 0; for (int i = 0; i < count; ++i) { b.points[i] = new Vec2(points_[i]); //if (points_[i].Y < b.minY) b.minY = points_[i].Y; //else if (points_[i].Y > b.maxY) b.maxY = points_[i].Y; } //b.rangeY = b.maxY - b.minY; findRange(b); return b; }
private static void findRange(Bezier b) { b.minY = b.points[0].Y; b.maxY = b.points[b.points.Length - 1].Y; b.rangeY = b.maxY - b.minY; }
public static Bezier Moved(Bezier old, double offset) { Bezier b = new Bezier(old.points); b.moveHorizontal(offset); return b; }