public void update() {
		
		if (np == 0) {
			recontrol(4);
			for (int i=0; i<4; ++i) {
				c[i].x = 0.0;
				c[i].y = 0.0;
			}
		} else if (np == 1) {
			recontrol(5);
			for (int i=0; i<5; ++i) {
				c[i].x = p[0].x;
				c[i].y = p[0].y;
			}
		} else {
			recontrol(np + 4);
			
			// Initialization:
			final int max = np - 1;
			for (int i=0; i<=max; ++i) {
				c[i].x = p[i].x;
				c[i].y = p[i].y;
			}
			double Dx = CBSP*c[max].x;
			double Dy = CBSP*c[max].y;
			double Ex = CBSP*c[0].x;
			double Ey = CBSP*c[0].y;
			double zin = CBSP;
			for (int i=1; i<=max; ++i) {
				zin *= CBSP;
				Dx += zin*c[max-i].x;
				Dy += zin*c[max-i].y;
				Ex += zin*c[i].x;
				Ey += zin*c[i].y;
			}
			final double tmp1 = 1.0 - zin;
			final double tmp2 = (1.0 - CBSP*CBSP)*tmp1;
			
			// Causal filter:
			c[0].x += Dx/tmp1;
			c[0].y += Dy/tmp1;
			for (int i=1; i<max; ++i) {
				c[i].x += CBSP*c[i-1].x;
				c[i].y += CBSP*c[i-1].y;
			}
			
			// Anti-causal filter:
			c[max].x = -(Dx + CBSP*Ex)/tmp2;
			c[max].y = -(Dy + CBSP*Ey)/tmp2;
			for (int i=max-1; i>=0; --i) {
				c[i].x = CBSP*(c[i+1].x - c[i].x);
				c[i].y = CBSP*(c[i+1].y - c[i].y);
			}
			
			// Scale, shift, and periodize:
			for (int i1=max, i2=max+2; i1>=0; --i1, --i2) {
				c[i2].x = CBSF*c[i1].x;
				c[i2].y = CBSF*c[i1].y;
			}
			c[0].x = c[np].x;
			c[0].y = c[np].y;
			c[1].x = c[np+1].x;
			c[1].y = c[np+1].y;
			c[np+2].x = c[2].x;
			c[np+2].y = c[2].y;
			c[np+3].x = c[3].x;
			c[np+3].y = c[3].y;
		}
		
		contour = contour();
	}