Correctly compare relations with shared origin.

The previous implementation did not handle comparing relation sets that shared one endpoint, but not the other. If either endpoint was shared, the comparison function returned true, that the relations were the same. Now it will check to make sure that both endpoints, instead of just one, are shared.
Just a question: I would read this better if it were like:
for (var i = 0; i < endpointSetA.length; i += 1) {
Is your version a JS idiom, or is it any different?