firstAbove = !firstAbove; return new SplitResults(below, above);
firstAbove = !firstAbove; return new SplitResults(below, above);
firstAbove = !firstAbove; return new SplitResults(below, above);
public Segment.SplitResults split(double y) { if ((y == p1.y) || (y == p2.y)) return null; if ((y <= p1.y) && (y <= p2.y)) return null; if ((y >= p1.y) && (y >= p2.y)) return null; // This should be checked for numerical stability. So you // need to ensure that p2.y-p1.y retains enough bits to be // useful. double t = (y-p1.y)/(p2.y-p1.y); Segment [] t0 = {getSegment(0,t)}; Segment [] t1 = {getSegment(t,1)}; if (p2.y < y) return new Segment.SplitResults(t0, t1); return new Segment.SplitResults(t1, t0); }
public Segment.SplitResults split(double y) { if ((y == p1.y) || (y == p2.y)) return null; if ((y <= p1.y) && (y <= p2.y)) return null; if ((y >= p1.y) && (y >= p2.y)) return null; // This should be checked for numerical stability. So you // need to ensure that p2.y-p1.y retains enough bits to be // useful. double t = (y-p1.y)/(p2.y-p1.y); Segment [] t0 = {getSegment(0,t)}; Segment [] t1 = {getSegment(t,1)}; if (p2.y < y) return new Segment.SplitResults(t0, t1); return new Segment.SplitResults(t1, t0); }
public Segment.SplitResults split(double y) { if ((y == p1.y) || (y == p2.y)) return null; if ((y <= p1.y) && (y <= p2.y)) return null; if ((y >= p1.y) && (y >= p2.y)) return null; // This should be checked for numerical stability. So you // need to ensure that p2.y-p1.y retains enough bits to be // useful. double t = (y-p1.y)/(p2.y-p1.y); Segment [] t0 = {getSegment(0,t)}; Segment [] t1 = {getSegment(t,1)}; if (p2.y < y) return new Segment.SplitResults(t0, t1); return new Segment.SplitResults(t1, t0); }