public void DrawBazia(curve Curve) { double px; double py; double px2; double py2; double t; // t is 1.0/the number of wanted line, calculated in the mouseClick function point[] bazia = new point[4]; bazia[0] = new point(Curve.first.x, Curve.first.y); bazia[1] = new point(Curve.second.x, Curve.second.y); bazia[2] = new point(Curve.thired.x, Curve.thired.y); bazia[3] = new point(Curve.fourth.x, Curve.fourth.y); for (t = 0.0; t <= 1.0; t += 0.001) { px = (int)((1 - t) * (1 - t) * (1 - t) * bazia[0].x + 3 * t * (1 - t) * (1 - t) * bazia[1].x + 3 * t * t * (1 - t) * bazia[2].x + t * t * t * bazia[3].x); py = (int)((1 - t) * (1 - t) * (1 - t) * bazia[0].y + 3 * t * (1 - t) * (1 - t) * bazia[1].y + 3 * t * t * (1 - t) * bazia[2].y + t * t * t * bazia[3].y); t += baziaFactor; //incress t to get the second point px2 = (int)((1 - t) * (1 - t) * (1 - t) * bazia[0].x + 3 * t * (1 - t) * (1 - t) * bazia[1].x + 3 * t * t * (1 - t) * bazia[2].x + t * t * t * bazia[3].x); py2 = (int)((1 - t) * (1 - t) * (1 - t) * bazia[0].y + 3 * t * (1 - t) * (1 - t) * bazia[1].y + 3 * t * t * (1 - t) * bazia[2].y + t * t * t * bazia[3].y); drawLine(new point(px, py), new point(px2, py2)); } this.Refresh(); }
public PictureJson(int numPoints, int numLines, int numCircles, int numCurves, int numPoli) { //Points = new point[numPoints]; Lines = new line[numLines]; Circles = new circle[numCircles]; Curves = new curve[numCurves]; Poligon = new poligon[numPoli]; }