private void InitScanLineNewEdgeTable(List <EDGE>[] NET, List <Point> Q, int ymin, int ymax) { List <int> temp = new List <int>(); EDGE e; for (int i = 0; i < Q.Count; i++) { Point ps = Q[i]; Point pe = Q[(i + 1) % Q.Count]; Point pss = Q[(i - 1 + Q.Count) % Q.Count]; Point pee = Q[(i + 2) % Q.Count]; if (pe.Y != ps.Y)//Do not process parallel lines { e = new EDGE(); e.dx = (double)(pe.X - ps.X) / (double)(pe.Y - ps.Y) * step; if (pe.Y > ps.Y) { e.xi = ps.X; if (pee.Y >= pe.Y) { e.ymax = pe.Y - step; } else { e.ymax = pe.Y; } NET[ps.Y - ymin].Add(e);//Join the corresponding NET temp.Add(ps.Y - ymin); } else { e.xi = pe.X; if (pss.Y >= ps.Y) { e.ymax = ps.Y - step; } else { e.ymax = ps.Y; } NET[pe.Y - ymin].Add(e);//Join the corresponding NET temp.Add(pe.Y - ymin); } } } for (int i = 0; i < temp.Count; i++) { My_Sort(ref NET[temp[i]]); } }
private void My_Sort(ref List <EDGE> list) { EDGE d = new EDGE(); for (int i = 0; i < list.Count - 1; i++) { for (int j = i + 1; j < list.Count; j++) { if (list[j] < list[i]) { d = list[j]; list[j] = list[i]; list[i] = d; } } } }
private void UpdateAetEdgeInfo(EDGE e) { e.xi += e.dx; }
private bool IsEdgeOutOfActive(EDGE obj) { return(line == obj.ymax); }