當前位置: 首頁>>代碼示例>>Java>>正文


Java QuadCurve2D.solveQuadratic方法代碼示例

本文整理匯總了Java中java.awt.geom.QuadCurve2D.solveQuadratic方法的典型用法代碼示例。如果您正苦於以下問題:Java QuadCurve2D.solveQuadratic方法的具體用法?Java QuadCurve2D.solveQuadratic怎麽用?Java QuadCurve2D.solveQuadratic使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.geom.QuadCurve2D的用法示例。


在下文中一共展示了QuadCurve2D.solveQuadratic方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getHorizontalParams

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
public static int getHorizontalParams(double c0, double cp0,
                                      double cp1, double c1,
                                      double ret[]) {
    if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
        return 0;
    }
    c1 -= cp1;
    cp1 -= cp0;
    cp0 -= c0;
    ret[0] = cp0;
    ret[1] = (cp1 - cp0) * 2;
    ret[2] = (c1 - cp1 - cp1 + cp0);
    int numroots = QuadCurve2D.solveQuadratic(ret, ret);
    int j = 0;
    for (int i = 0; i < numroots; i++) {
        double t = ret[i];
        // No splits at t==0 and t==1
        if (t > 0 && t < 1) {
            if (j < i) {
                ret[j] = t;
            }
            j++;
        }
    }
    return j;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:27,代碼來源:Order3.java

示例2: getHorizontalParams

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
public static int getHorizontalParams(double c0, double cp0,
			double cp1, double c1,
			double ret[]) {
		if (c0 <= cp0 && cp0 <= cp1 && cp1 <= c1) {
			return 0;
		}
		c1 -= cp1;
		cp1 -= cp0;
		cp0 -= c0;
		ret[0] = cp0;
		ret[1] = (cp1 - cp0) * 2;
		ret[2] = (c1 - cp1 - cp1 + cp0);
		int numroots = QuadCurve2D.solveQuadratic(ret, ret);
		int j = 0;
		for (int i = 0; i < numroots; i++) {
			double t = ret[i];
//			No splits at t==0 and t==1
			if (t > 0 && t < 1) {
				if (j < i) {
					ret[j] = t;
				}
				j++;
			}
		}
		return j;
	}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:27,代碼來源:Order3X.java

示例3: getMinMax

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
private void getMinMax(double p1, double p2,
                       double p3, double p4,
                       double [] minMax) {
    if (p4 > p1){
        minMax[0] = p1; minMax[1] = p4;
    } else {
        minMax[0] = p4; minMax[1] = p1;
    }

    double c0 = 3*(p2-p1);
    double c1 = 6*(p3-p2);
    double c2 = 3*(p4-p3);
    double [] eqn = { c0, c1-2*c0, c2-c1+c0 };
    int roots = QuadCurve2D.solveQuadratic(eqn);
    for (int r=0; r<roots; r++) {
        double tv = eqn[r];
        if ((tv <= 0) || (tv >= 1)) continue;
        tv = ((1-tv)*(1-tv)*(1-tv)*p1 +
                3*tv*(1-tv)*(1-tv)*p2 +
                3*tv*tv*(1-tv)*p3 +
                tv*tv*tv*p4);
        if      (tv < minMax[0]) minMax[0] = tv;
        else if (tv > minMax[1]) minMax[1] = tv;
    }
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:26,代碼來源:Cubic.java

示例4: findCubicZeros

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
private static int findCubicZeros(double zeros[], double cur, double cp0,
		double cp1, double end) {
	// The polynomial form of the Cubic is:
	// eqn[0] = cur;
	// eqn[1] = (cp0 - cur) * 3.0;
	// eqn[2] = (cp1 - cp0 - cp0 + cur) * 3.0;
	// eqn[3] = end + (cp0 - cp1) * 3.0 - cur;
	// Since we want the derivative, we can calculate it in one step:
	zeros[0] = (cp0 - cur) * 3.0;
	zeros[1] = (cp1 - cp0 - cp0 + cur) * 6.0;
	zeros[2] = (end + (cp0 - cp1) * 3.0 - cur) * 3.0;
	int num = QuadCurve2D.solveQuadratic(zeros);
	int ret = 0;
	for (int i = 0; i < num; i++) {
		double t = zeros[i];
		if (t > 0 && t < 1) {
			zeros[ret] = t;
			ret++;
		}
	}
	return ret;
}
 
開發者ID:iwabuchiken,項目名稱:freemind_1.0.0_20140624_214725,代碼行數:23,代碼來源:PathBBox.java

示例5: nextVertical

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
public double nextVertical(double t0, double t1) {
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        if (eqn[i] > t0 && eqn[i] < t1) {
            t1 = eqn[i];
        }
    }
    return t1;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:11,代碼來源:Order3.java

示例6: enlarge

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
public void enlarge(Rectangle2D r) {
    r.add(x0, y0);
    double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
    int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
    for (int i = 0; i < numroots; i++) {
        double t = eqn[i];
        if (t > 0 && t < 1) {
            r.add(XforT(t), YforT(t));
        }
    }
    r.add(x1, y1);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:Order3.java

示例7: nextVertical

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
@Override
public double nextVertical(double t0, double t1) {
	double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
	int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
	for (int i = 0; i < numroots; i++) {
		if (eqn[i] > t0 && eqn[i] < t1) {
			t1 = eqn[i];
		}
	}
	return t1;
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:12,代碼來源:Order3X.java

示例8: enlarge

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
@Override
public void enlarge(Rectangle2D r) {
	r.add(x0, y0);
	double eqn[] = {xcoeff1, 2 * xcoeff2, 3 * xcoeff3};
	int numroots = QuadCurve2D.solveQuadratic(eqn, eqn);
	for (int i = 0; i < numroots; i++) {
		double t = eqn[i];
		if (t > 0 && t < 1) {
			r.add(XforT(t), YforT(t));
		}
	}
	r.add(x1, y1);
}
 
開發者ID:mickleness,項目名稱:pumpernickel,代碼行數:14,代碼來源:Order3X.java

示例9: findRoots

import java.awt.geom.QuadCurve2D; //導入方法依賴的package包/類
protected int findRoots(double y, double [] roots) {
    double [] eqn = { p1.y-y, 2*(p2.y-p1.y), p1.y-2*p2.y+p3.y };
    return QuadCurve2D.solveQuadratic(eqn, roots);
    // return solveQuad(eqn[2], eqn[1], eqn[0], roots);
}
 
開發者ID:git-moss,項目名稱:Push2Display,代碼行數:6,代碼來源:Quadradic.java


注:本文中的java.awt.geom.QuadCurve2D.solveQuadratic方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。