public Segment splitAfter(double t) { return getSegment(t, 1.0); }
public static int solveQuad(double a, double b, double c, double [] roots) { // System.err.println("Quad: " + a +"t^2 + " + b +"t + " + c); if (a == 0) { // no square term. return solveLine(b, c, roots); } double det = b*b-4*a*c; // System.err.println("Det: " + det); if (Math.abs(det) <= tol*b*b) { // one real root (det doesn't contain any useful info) roots[0] = -b/(2*a); return 1; } if (det < 0) return 0; // No real roots // Two real roots det = Math.sqrt(det); double w = -(b + matchSign(det, b)); roots[0] = (2*c)/w; roots[1] = w/(2*a); return 2; }
public Segment.SplitResults split(double y) { double [] roots = { 0, 0, 0 }; int numSol = findRoots(y, roots); if (numSol == 0) return null; // No split for (int i=1; i<numSegments; i++) { parts[pIdx] = getSegment(segs[i-1], segs[i]); Point2D.Double pt = parts[pIdx].eval(0.5); if (prevAbove == above) { parts[pIdx-1] = getSegment(pT, segs[i]); } else { pIdx++;
int dCnt = solveQuad(3*a3, 2*a2, a1, dRoots); double [] yVals = {0, 0, 0, 0}; double [] tVals = {0, 0, 0, 0};
public static int solveQuad(double a, double b, double c, double [] roots) { // System.err.println("Quad: " + a +"t^2 + " + b +"t + " + c); if (a == 0) { // no square term. return solveLine(b, c, roots); } double det = b*b-4*a*c; // System.err.println("Det: " + det); if (Math.abs(det) <= tol*b*b) { // one real root (det doesn't contain any useful info) roots[0] = -b/(2*a); return 1; } if (det < 0) return 0; // No real roots // Two real roots det = Math.sqrt(det); double w = -(b + matchSign(det, b)); roots[0] = (2*c)/w; roots[1] = w/(2*a); return 2; }
public Segment.SplitResults split(double y) { double [] roots = { 0, 0, 0 }; int numSol = findRoots(y, roots); if (numSol == 0) return null; // No split for (int i=1; i<numSegments; i++) { parts[pIdx] = getSegment(segs[i-1], segs[i]); Point2D.Double pt = parts[pIdx].eval(0.5); if (prevAbove == above) { parts[pIdx-1] = getSegment(pT, segs[i]); } else { pIdx++;
int dCnt = solveQuad(3*a3, 2*a2, a1, dRoots); double [] yVals = {0, 0, 0, 0}; double [] tVals = {0, 0, 0, 0};
public static int solveQuad(double a, double b, double c, double [] roots) { // System.err.println("Quad: " + a +"t^2 + " + b +"t + " + c); if (a == 0) { // no square term. return solveLine(b, c, roots); } double det = b*b-4*a*c; // System.err.println("Det: " + det); if (Math.abs(det) <= tol*b*b) { // one real root (det doesn't contain any useful info) roots[0] = -b/(2*a); return 1; } if (det < 0) return 0; // No real roots // Two real roots det = Math.sqrt(det); double w = -(b + matchSign(det, b)); roots[0] = (2*c)/w; roots[1] = w/(2*a); return 2; }
public Segment.SplitResults split(double y) { double [] roots = { 0, 0, 0 }; int numSol = findRoots(y, roots); if (numSol == 0) return null; // No split for (int i=1; i<numSegments; i++) { parts[pIdx] = getSegment(segs[i-1], segs[i]); Point2D.Double pt = parts[pIdx].eval(0.5); if (prevAbove == above) { parts[pIdx-1] = getSegment(pT, segs[i]); } else { pIdx++;
public Segment splitBefore(double t) { return getSegment(0.0, t); }
int dCnt = solveQuad(3*a3, 2*a2, a1, dRoots); double [] yVals = {0, 0, 0, 0}; double [] tVals = {0, 0, 0, 0};
public Segment splitAfter(double t) { return getSegment(t, 1.0); }
public Segment splitAfter(double t) { return getSegment(t, 1.0); }
public Segment splitBefore(double t) { return getSegment(0.0, t); }
public Segment splitBefore(double t) { return getSegment(0.0, t); }