public void AddTriangle(int triangleID, int id0, int id1, Vector3 v0, Vector3 v1) { #if PROFILING MeasureIt.Begin("AddTriangle"); #endif // we need to compute position hash to make sure we find all (duplicated) vertices with different edges int hash0, hash1; lsHash.Hash(v0, v1, out hash0, out hash1); // filter out points with similar positions if (hash0 == hash1) { #if PROFILING MeasureIt.End("AddTriangle"); #endif return; } MidPoint midPoint; if (midPoints.TryGetValue(hash0, out midPoint)) { if (midPoint.idNext == HashType.MaxValue && midPoint.idPrev != hash1) { midPoint.idNext = hash1; } else if (midPoint.idPrev == HashType.MaxValue && midPoint.idNext != hash1) { midPoint.idPrev = hash1; } midPoints[hash0] = midPoint; } else { midPoints.Add(hash0, new MidPoint { id = hash0, vertexId = id0, idNext = hash1, idPrev = HashType.MaxValue /*, position = v0*/ }); } if (midPoints.TryGetValue(hash1, out midPoint)) { if (midPoint.idNext == HashType.MaxValue && midPoint.idPrev != hash0) { midPoint.idNext = hash0; } else if (midPoint.idPrev == HashType.MaxValue && midPoint.idNext != hash0) { midPoint.idPrev = hash0; } midPoints[hash1] = midPoint; } else { midPoints.Add(hash1, new MidPoint { id = hash1, vertexId = id1, idPrev = hash0, idNext = HashType.MaxValue /*, position = v1*/ }); } MidPointsCount = midPoints.Count; #if PROFILING MeasureIt.End("AddTriangle"); #endif }