private void Matching() { // 어릴적 짯던 소스라 매우 더럽다.. this.trace1 = Data1.Trace().Select(pt => new PtrPoint(pt.X, pt.Y)).ToArray(); this.trace2 = Data2.Trace().Select(pt => new PtrPoint(pt.X, pt.Y)).ToArray(); var cQue = new Queue(); PtrChain lCh = null; PtrChain lrCh = null; for (int i = 0; i <= trace1.Length - 1; i++) { int abs_index = (int)((i / (trace1.Length - 1f)) * (trace2.Length - 1)); if (lCh == null) { lCh = CreateSakuraChain(trace1[i].ToPoint()); } else { PointF tPt = trace2[abs_index].ToPoint(); PointF tPt2 = trace2[Math.Max(abs_index - 1, 0)].ToPoint(); PtrChain rCh = CreateSakuraChain(trace1[i].ToPoint()); double d = MorphData.Distance(rCh.Point.ToPoint(), lCh.Point.ToPoint()); double d2 = MorphData.Distance(tPt2, tPt); if (d >= 3 * 2 | d2 >= 3 * 2) { cQue.Enqueue(lrCh); lCh = null; continue; } lCh.ToPoint = tPt; rCh.ToPoint = tPt2; lCh.Connect(rCh); lrCh = rCh; LinkedData.Add(lCh); LinkedData.Add(rCh); AddScene(lCh); AddScene(rCh); lCh = null; i--; } } }