private void generateSpline() { OUTLINE_LINES.clear(); OUTLINE_POINTS.clear(); SPLINE_LINES.clear(); double step = 0.00130718954248366D; double t = 0.00130718954248366D; DoublePoint points2[] = new DoublePoint[n]; int Xold = (int) points[0].x; int Yold = (int) points[0].y; for (int i = 0; i < n; i++) { int X = (int) points[i].x; int Y = (int) points[i].y; OUTLINE_POINTS.add(new Point(X, Y)); } if (n > 2) { int Xo = Xold; int Yo = Yold; for (int i = 1; i < n; i++) { int X = (int) points[i].x; int Y = (int) points[i].y; OUTLINE_LINES.add(new Line(Xo, Yo, X, Y)); Xo = X; Yo = Y; } } for (int k = 1; k < 765; k++) { System.arraycopy(points, 0, points2, 0, n); for (int j = n - 1; j > 0; j--) { for (int i = 0; i < j; i++) { points2[i].x = (1.0D - t) * points2[i].x + t * points2[i + 1].x; points2[i].y = (1.0D - t) * points2[i].y + t * points2[i + 1].y; } } int X = (int) points2[0].x; int Y = (int) points2[0].y; SPLINE_LINES.add(new Line(Xold, Yold, X, Y)); Xold = X; Yold = Y; t += 0.00130718954248366D; } }
public void moveMouse(int x, int y, int randomX, int randomY) { int thisX = getLocation().x; int thisY = getLocation().y; if (thisX < 0 || thisY < 0) switch (nextInt(1, 5)) { case 1: // '\001' thisX = 1; thisY = nextInt(0, 500); setMousePos(thisX, thisY); break; case 2: // '\002' thisX = nextInt(0, 765); thisY = 501; setMousePos(thisX, thisY); break; case 3: // '\003' thisX = 766; thisY = nextInt(0, 500); setMousePos(thisX, thisY); break; case 4: // '\004' thisX = nextInt(0, 765); thisY = 1; setMousePos(thisX, thisY); break; } if (thisX == x && thisY == y) return; if (Point2D.distanceSq(thisX, thisY, x, y) < 10D) { SPLINE_LINES.clear(); SPLINE_LINES.add(new Line(thisX, thisY, nextInt(x, x + randomX), nextInt(y, y + randomY))); } else { createSpline( new Point(thisX, thisY), new Point(nextInt(x, x + randomX), nextInt(y, y + randomY))); } splineMouse(); }