private List<List<Vector3> > getVertexGrid() {
// At the moment this works only for points that form uniform grid
List<List<Vector3> > vertexGrid = new ArrayList<List<Vector3> >();
for (int i = 0; i < vertices.size(); i++) {
Vector3 vertex = vertices.get(i);
// Find correct row for vertex and add it there.
boolean found = false;
for (int j = 0; j < vertexGrid.size(); j++) {
// Add first vertex to empty row
if (vertexGrid.get(j).size() == 0) {
vertexGrid.get(j).add(vertex);
found = true;
break;
}
Vector3 temp =vertexGrid.get(j).get(0);
if (temp.z - 0.01 < vertex.z && temp.z + 0.01 > vertex.z) {
vertexGrid.get(j).add(vertex);
found = true;
break;
}