114115116117118119120121122123124
for(int i = 1; i < points.size(); i++) { candidate = points.get(i); if (crossProduct(last, candidate, next) > 0 || crossProduct(last, candidate, next) == 0 && last.dist(candidate) > last.dist(next)) { next = candidate; } } result.add(next);