import java.applet.*; import java.awt.*; public class bezierlet extends Applet implements Runnable { private class i_points { public int[] xx, yy; public i_points(int[] nxx, int[] nyy) { xx = nxx; yy = nyy; } } private class point { public double x, y; public point() {} public point(double px, double py) { x = px; y = py; } public point(point p) { x = p.x; y = p.y; } } private class bezier { private point[] pts_; public bezier(point[] p) { int n = p.length; pts_ = new point[n]; for(int i=0; i right) { guides[i].x = 2.0*right - guides[i].x; velocities[i].x = - velocities[i].x; } if(guides[i].y < top) { guides[i].y = 2.0*top - guides[i].y; velocities[i].y = - velocities[i].y; } else if(guides[i].y > bottom) { guides[i].y = 2.0*bottom - guides[i].y; velocities[i].y = - velocities[i].y; } } guides[degree-2].x = 2.0*guides[0].x - guides[1].x; guides[degree-2].y = 2.0*guides[0].y - guides[1].y; try { long dt = time_step - (System.currentTimeMillis() - t0); if(dt < 0) dt = 20; Thread.sleep(dt); } catch(InterruptedException e) {} } } }