int nv = vertices[3].squaredDistanceTo(vertices[2]) < MathUtil.EPSILON ? 3 : 4;
int offset = mesh.getNumVertices();
for (int i = 0; i < nv; i++) {
mesh.addVertex(vertices[i]);
}
mesh.addFace(new int[]{ offset + 0, offset + 1, offset + 2 });
if (nv > 3) { // quad
mesh.addFace(new int[]{ offset + 2, offset + 3, offset + 0 });