If someone who isn't as concerned about performance as I was wants to take over the Scala port -- I just realized that there are some nice opportunities there to take advantage of a more functional programming style -- and with recent optimizations in JVM's, the performance might even not be that much worse.
So it might be a nice exercise to practice going from imperative to functional programming -- because a lot of the code there is still as imperative as the original.
For example, see https://github.com/Villane/scalabox2d/b ... ider.scala
the edgeSeparation function is pretty much the same as in the C++ version. It's even harder to read because of the inlining of some operations, but disregarding that it still isn't much more concise. But what it essentially boils down to is (in pseudocode, not exactly Scala):
//b2Assert(0 <= edge1 && edge1 < poly1->m_count);
// Convert normal from poly1's frame into poly2's frame.
val normal1World = xf1.rot * poly1.normals[edge1];
val normal1 = xf2.rotᵀ * normal1World;
// Find support vertex on poly2 for -normal.
val v := poly2.vertices.findMin(v -> v ∙ normal1);
(xf1 * poly1.vertices[edge1] - xf2 * v) ∙ normal1World
This is assuming there would be a findMin function in the library, which there probably isn't, but it should be easy enough to add as a separate function or "extension method". [EDIT] There is that function in Scala 2.9 at least, it's called minBy
I'd actually love to go and do things like this myself just as an exercise, and then compare performance with imperative version, but I don't have the time