public double getLength() { return getLength(0.000001); }
public double maxY() { double [] minMax = {0, 0}; getMinMax(p1.y, p2.y, p3.y, minMax); return minMax[1]; } public Rectangle2D getBounds2D() {
/** * Subdivides this Quadradic curve into two curves at given t. * @param q0 if non-null contains portion of curve from 0->t. * @param q1 if non-null contains portion of curve from t->1. */ public void subdivide(double t, Quadradic q0, Quadradic q1) { Point2D.Double np = eval(t); Point2D.Double npd = evalDt(t); if (q0 != null) { q0.p1.x = p1.x; q0.p1.y = p1.y; q0.p2.x = np.x-(npd.x*t*.5); q0.p2.y = np.y-(npd.y*t*.5); q0.p3.x = np.x; q0.p3.y = np.y; } if (q1 != null) { q1.p1.x = np.x; q1.p1.y = np.y; q1.p2.x = np.x+(npd.x*(1-t)*.5); q1.p2.y = np.y+(npd.y*(1-t)*.5); q1.p3.x = p3.x; q1.p3.y = p3.y; } }
public Object clone() { return new Quadradic(new Point2D.Double(p1.x, p1.y), new Point2D.Double(p2.x, p2.y), new Point2D.Double(p3.x, p3.y)); }
/** * Subdivides this Quadradic curve into two curves at t. * can be done with getSegment but this is more efficent. * @param s0 if non-null contains portion of curve from 0->.5 * @param s1 if non-null contains portion of curve from .5->1 */ public void subdivide(double t, Segment s0, Segment s1) { Quadradic q0=null, q1=null; if (s0 instanceof Quadradic) q0 = (Quadradic)s0; if (s1 instanceof Quadradic) q1 = (Quadradic)s1; subdivide(t, q0, q1); }
public double getLength(double maxErr) { double dx, dy; dx = p2.x-p1.x; dy = p2.y-p1.y; double leftLegLen = Math.sqrt(dx*dx+dy*dy); dx = p3.x-p2.x; dy = p3.y-p2.y; double rightLegLen = Math.sqrt(dx*dx+dy*dy); double eps = maxErr*(leftLegLen+rightLegLen); return subLength(leftLegLen, rightLegLen, eps); }
/** * Subdivides this Quadradic curve into two curves at given t. * @param q0 if non-null contains portion of curve from 0->t. * @param q1 if non-null contains portion of curve from t->1. */ public void subdivide(double t, Quadradic q0, Quadradic q1) { Point2D.Double np = eval(t); Point2D.Double npd = evalDt(t); if (q0 != null) { q0.p1.x = p1.x; q0.p1.y = p1.y; q0.p2.x = np.x-(npd.x*t*.5); q0.p2.y = np.y-(npd.y*t*.5); q0.p3.x = np.x; q0.p3.y = np.y; } if (q1 != null) { q1.p1.x = np.x; q1.p1.y = np.y; q1.p2.x = np.x+(npd.x*(1-t)*.5); q1.p2.y = np.y+(npd.y*(1-t)*.5); q1.p3.x = p3.x; q1.p3.y = p3.y; } }
public Object clone() { return new Quadradic(new Point2D.Double(p1.x, p1.y), new Point2D.Double(p2.x, p2.y), new Point2D.Double(p3.x, p3.y)); }
/** * Subdivides this Quadradic curve into two curves at t. * can be done with getSegment but this is more efficent. * @param s0 if non-null contains portion of curve from 0->.5 * @param s1 if non-null contains portion of curve from .5->1 */ public void subdivide(double t, Segment s0, Segment s1) { Quadradic q0=null, q1=null; if (s0 instanceof Quadradic) q0 = (Quadradic)s0; if (s1 instanceof Quadradic) q1 = (Quadradic)s1; subdivide(t, q0, q1); }
public double getLength(double maxErr) { double dx, dy; dx = p2.x-p1.x; dy = p2.y-p1.y; double leftLegLen = Math.sqrt(dx*dx+dy*dy); dx = p3.x-p2.x; dy = p3.y-p2.y; double rightLegLen = Math.sqrt(dx*dx+dy*dy); double eps = maxErr*(leftLegLen+rightLegLen); return subLength(leftLegLen, rightLegLen, eps); }
public double maxY() { double [] minMax = {0, 0}; getMinMax(p1.y, p2.y, p3.y, minMax); return minMax[1]; } public Rectangle2D getBounds2D() {
/** * Subdivides this Quadradic curve into two curves at given t. * @param q0 if non-null contains portion of curve from 0->t. * @param q1 if non-null contains portion of curve from t->1. */ public void subdivide(double t, Quadradic q0, Quadradic q1) { Point2D.Double np = eval(t); Point2D.Double npd = evalDt(t); if (q0 != null) { q0.p1.x = p1.x; q0.p1.y = p1.y; q0.p2.x = np.x-(npd.x*t*.5); q0.p2.y = np.y-(npd.y*t*.5); q0.p3.x = np.x; q0.p3.y = np.y; } if (q1 != null) { q1.p1.x = np.x; q1.p1.y = np.y; q1.p2.x = np.x+(npd.x*(1-t)*.5); q1.p2.y = np.y+(npd.y*(1-t)*.5); q1.p3.x = p3.x; q1.p3.y = p3.y; } }
public Segment reverse() { return new Quadradic(new Point2D.Double(p3.x, p3.y), new Point2D.Double(p2.x, p2.y), new Point2D.Double(p1.x, p1.y)); }
/** * Subdivides this Quadradic curve into two curves at t = 0.5. * can be done with getSegment but this is more efficent. * @param s0 if non-null contains portion of curve from 0->.5 * @param s1 if non-null contains portion of curve from .5->1 */ public void subdivide(Segment s0, Segment s1) { Quadradic q0=null, q1=null; if (s0 instanceof Quadradic) q0 = (Quadradic)s0; if (s1 instanceof Quadradic) q1 = (Quadradic)s1; subdivide(q0, q1); }
public double getLength(double maxErr) { double dx, dy; dx = p2.x-p1.x; dy = p2.y-p1.y; double leftLegLen = Math.sqrt(dx*dx+dy*dy); dx = p3.x-p2.x; dy = p3.y-p2.y; double rightLegLen = Math.sqrt(dx*dx+dy*dy); double eps = maxErr*(leftLegLen+rightLegLen); return subLength(leftLegLen, rightLegLen, eps); }