public void cluster() {
		_ls.log("clustering");

		/* If it is the first time, create the k-means clustering points. */
		if (_firstTime) 
			generateInitialMeans();

		/* Reset the associations between means and points. */
		Map<NamedPoint, Set<NamedPoint>> assignments = 
				new HashMap<NamedPoint, Set<NamedPoint>>();
		for (NamedPoint mean : _means)
			assignments.put(mean, new HashSet<NamedPoint>());
		
		/* Associate every point with the nearest mean. */
		for (NamedPoint np : _points) {
			double currentDistance = Double.MAX_VALUE;
			NamedPoint meanToAssignTo = null; //TODO: could be bad if 0 means
			for (NamedPoint mean : _means) {
				if (mean.distance(np) < currentDistance) {
					np.setColor(mean.getColor());
					currentDistance = mean.distance(np);
					meanToAssignTo = mean;
				}
			}
			assignments.get(meanToAssignTo).add(np);
		}

		/* Move the mean to the center of the points assigned to it. */
		for (NamedPoint mean : assignments.keySet()) {
			int sumX = 0;
			int sumY = 0;

			for (NamedPoint np : assignments.get(mean)) {
				sumX += np.getXPosition();
				sumY += np.getYPosition();
			}

			if (assignments.get(mean).size() != 0) {
				mean.setXPosition(sumX/assignments.get(mean).size());
				mean.setYPosition(sumY/assignments.get(mean).size());
			}
		}

		// + tell the view the locations of the means and the Voronoi lines 
		// TODO: figure out how to draw Voronoi lines
		updateView();
	}