public static Crossings FindCrossings(ArrayList curves, double xlo, double ylo, double xhi, double yhi) { Crossings cross = new EvenOdd(xlo, ylo, xhi, yhi); IEnumerator enumerator = curves.GetEnumerator(); while (enumerator.MoveNext()) { Curve c = (Curve)enumerator.Current; if (c.AccumulateCrossings(cross)) { return(null); } } return(cross); }
public bool AccumulateCubic(double x0, double y0, double[] coords) { if (y0 < _ylo && coords[1] < _ylo && coords[3] < _ylo && coords[5] < _ylo) { return(false); } if (y0 > _yhi && coords[1] > _yhi && coords[3] > _yhi && coords[5] > _yhi) { return(false); } if (x0 > _xhi && coords[0] > _xhi && coords[2] > _xhi && coords[4] > _xhi) { return(false); } if (x0 < _xlo && coords[0] < _xlo && coords[2] < _xlo && coords[4] < _xlo) { if (y0 <= coords[5]) { Record(Math.Max(y0, _ylo), Math.Min(coords[5], _yhi), 1); } else { Record(Math.Max(coords[5], _ylo), Math.Min(y0, _yhi), -1); } return(false); } Curve.InsertCubic(_tmp, x0, y0, coords); IEnumerator enumerator = _tmp.GetEnumerator(); while (enumerator.MoveNext()) { Curve c = (Curve)enumerator.Current; if (c.AccumulateCrossings(this)) { return(true); } } _tmp.Clear(); return(false); }