private static void CheckAddLineMap(TssLineMap lineMap, TssTriangleBuffer triBuf, int pt1, int pt2) { if (pt1 > pt2) { int tmp = pt1; pt1 = pt2; pt2 = tmp; } long key = MakeLineKey(pt1, pt2); TssLine line; if (!lineMap.TryGetValue(key, out line)) { line = new TssLine(); line.pt1 = pt1; line.pt2 = pt2; line.tri1 = triBuf.Count; line.tri2 = -1; lineMap.Add(key, line); } else { line.tri2 = triBuf.Count; lineMap[key] = line; } }
public TssTriangle(int idx1, int idx2, int idx3, TssLineMap lineMap, TssTriangleBuffer triBuf, TssVertexRefMap refMap) { vertIdx1 = idx1; vertIdx2 = idx2; vertIdx3 = idx3; AddVertRef(vertIdx1, vertIdx2, refMap); AddVertRef(vertIdx1, vertIdx3, refMap); AddVertRef(vertIdx2, vertIdx1, refMap); AddVertRef(vertIdx2, vertIdx3, refMap); AddVertRef(vertIdx3, vertIdx1, refMap); AddVertRef(vertIdx3, vertIdx2, refMap); line1 = MakeLineKey(vertIdx1, vertIdx2); CheckAddLineMap(lineMap, triBuf, vertIdx1, vertIdx2); line2 = MakeLineKey(vertIdx2, vertIdx3); CheckAddLineMap(lineMap, triBuf, vertIdx2, vertIdx3); line3 = MakeLineKey(vertIdx3, vertIdx1); CheckAddLineMap(lineMap, triBuf, vertIdx3, vertIdx1); }