public void FindCoincidentEdges(ProBuilderMesh mesh) { if (m_coincidentEdges.Count != 0) { return; } Dictionary <Vector3Tuple, HashSet <Edge> > coordinateToEdges = new Dictionary <Vector3Tuple, HashSet <Edge> >(); IList <Face> faces = mesh.faces; IList <Vector3> positions = mesh.positions; int faceCount = mesh.faceCount; for (int i = 0; i < faceCount; i++) { ReadOnlyCollection <Edge> edges = faces[i].edges; for (int n = 0; n < edges.Count; n++) { Edge edge = edges[n]; Vector3Tuple tuple = new Vector3Tuple(positions[edge.a], positions[edge.b]); HashSet <Edge> hs; if (!coordinateToEdges.TryGetValue(tuple, out hs)) { hs = new HashSet <Edge>(); coordinateToEdges.Add(tuple, hs); } if (!hs.Contains(edge)) { hs.Add(edge); } } } m_coincidentEdges.Clear(); foreach (HashSet <Edge> edges in coordinateToEdges.Values) { foreach (Edge edge in edges) { m_coincidentEdges.Add(edge, edges); } } }
public bool Equals(Vector3Tuple other) { return((a == other.a && b == other.b) || (a == other.b && b == other.a)); }