So thanks for the help.

Implemented the logic you were talking about:

Which looks close enough although smoother lines is something i’ll want later.

Code (this is not great code, but good enough for a test): (EDITED 2019-05-03)

```
public static Mesh findAllHighlightEdges(Mesh m) {
final float DIFF = 0.9f;
// Steps for this method:
// read edges->triangles into a map: edge,list<tri>
// iterate through the edges
// find any edges with only one triangle and add to list
// find any edges with a large difference between the triangle normals and add it as well
Map<Edge, List<Triangle>> edgeMap = new HashMap<Edge, List<Triangle>>();
int count = m.getTriangleCount();
System.out.println("Triangle count:" + count);
for (int i = 0; i < count; i++) {
Triangle tri = new Triangle();
m.getTriangle(i, tri);
//add edges
addToMap(edgeMap, new Edge(tri.get1(), tri.get2()), tri);
addToMap(edgeMap, new Edge(tri.get3(), tri.get2()), tri);
addToMap(edgeMap, new Edge(tri.get1(), tri.get3()), tri);
}
System.out.println("Edge count: " + edgeMap.size());
List<Edge> edges = new LinkedList<>();
for (Entry<Edge, List<Triangle>> a : edgeMap.entrySet()) {
//detect empty edges (only have a triangle on one side)
if (a.getValue().size() == 1) {
edges.add(a.getKey());
}
//detect large normal differences
if (a.getValue().size() == 2) {
//has 2 triangles
Triangle tri1 = a.getValue().get(0);
tri1.calculateNormal();
Triangle tri2 = a.getValue().get(1);
tri2.calculateNormal();
Vector3f normal1 = tri1.getNormal();
Vector3f normal2 = tri2.getNormal();
if (normal1.dot(normal2) < DIFF) {
edges.add(a.getKey());
}
}
}
Vector3f[] vertices = new Vector3f[edges.size()*2];
int i = 0;
for (Edge e: edges) {
vertices[i] = e.a;
vertices[i+1] = e.b;
i+=2;
}
Mesh newMesh = new Mesh();
newMesh.setMode(Mode.Lines);
newMesh.setBuffer(Type.Position, 3, BufferUtils.createFloatBuffer(vertices));
newMesh.updateBound();
return newMesh;
}
```

Edge class is just a 2 Vector3f class with a symmetric equals and hashCode().

Although the edge hashcode method is fairly important.