// ------------------------------------------------------------------------------------------------------------- // // The following should probably be moved into a "mesh" operator object that performs the // clean operation on a mesh. This way we can have lots of operations, without cluttering up basic // mesh functionality. // ------------------------------------------------------------------------------------------------------------- // public void clean() { while (connectAdjacentPaths()) ; // Remove any adjacent duplicates from the list, until none are found] List<Face> cleanedPolyLines = new ArrayList<Face>(); for (Face poly : faces) { while (removeAdjacentDuplicates(poly)) ; if (poly.getVerts().size() > 1) cleanedPolyLines.add(poly); } faces.clear(); faces.addAll(cleanedPolyLines); }
private boolean connectAdjacentPaths() { SerializableMultiMap<Face> joinedLines = new SerializableMultiMap<Face>(); if (faces.size() < 1) return false; // Add our first line list joinedLines.add(faces.get(0)); faces.remove(0); // Now check every one in the source list boolean merged = false; for (Face src : faces) { FindResults results = new FindResults(); if (findAdjacentPath(src, joinedLines, results)) { merged = true; Face dest = joinedLines.get(results.index); combinePaths(dest, src, results); } else joinedLines.add(src); } faces = joinedLines; return merged; }
// ------------------------------------------------------------------------------------------------------------- // public void clear() { faces.clear(); }
// ------------------------------------------------------------------------------------------------------------- // public void add(Face face) { faces.add(face); }