isUniqueEdge function

dynamic isUniqueEdge(
  1. dynamic start,
  2. dynamic end,
  3. dynamic edges
)

Implementation

isUniqueEdge(start, end, edges) {
  var hash1 = "${start.x},${start.y},${start.z}-${end.x},${end.y},${end.z}";
  var hash2 =
      "${end.x},${end.y},${end.z}-${start.x},${start.y},${start.z}"; // coincident edge

  if (edges.contains(hash1) == true || edges.contains(hash2) == true) {
    return false;
  } else {
    edges.addAll([hash1, hash2]);
    return true;
  }
}