当前位置: 首页>>代码示例>>Java>>正文


Java Crossing类代码示例

本文整理汇总了Java中org.apache.harmony.awt.gl.Crossing的典型用法代码示例。如果您正苦于以下问题:Java Crossing类的具体用法?Java Crossing怎么用?Java Crossing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Crossing类属于org.apache.harmony.awt.gl包,在下文中一共展示了Crossing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: intersectLineAndQuad

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
/**
 * It checks up if there is intersection of the line (x1, y1) - (x2, y2) and
 * the quad curve (qx1, qy1) - (qx2, qy2) - (qx3, qy3). The parameters of the intersection
 * area saved to params array. Therefore the params size must be at learst 4.
 * @return The method returns the quantity of roots lied in the defined interval 
 */
public static int intersectLineAndQuad(double x1, double y1, double x2, double y2,
                                       double qx1, double qy1, double qx2, double qy2, 
                                       double qx3, double qy3, double[] params) {
    double[] eqn = new double[3];
    double[] t = new double[2];
    double[] s = new double[2];
    double dy = y2 - y1;
    double dx = x2 - x1;
    int quantity = 0;
    int count = 0;

    eqn[0] = dy * (qx1 - x1) - dx * (qy1 - y1);
    eqn[1] = 2 * dy * (qx2 - qx1) - 2 * dx * (qy2 - qy1);
    eqn[2] = dy * (qx1 - 2 * qx2 + qx3) - dx *(qy1 -2 * qy2 + qy3);
    
    if ((count = Crossing.solveQuad(eqn, t)) == 0) {
        return 0;
    }

    for (int i = 0; i < count; i++) {
        if (dx != 0) {
            s[i] = (quad(t[i], qx1, qx2, qx3) - x1) / dx;
        } else if (dy != 0) {
            s[i] = (quad(t[i], qy1, qy2, qy3) - y1) / dy;
        } else {
        	s[i] = 0.0;
        }
        if (t[i] >= 0 && t[i] <= 1 && s[i] >= 0 && s[i] <= 1) {
            params[2 * quantity] = t[i];
            params[2 * quantity + 1] = s[i];
            ++quantity;
        }
    }

    return quantity;
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:43,代码来源:GeometryUtil.java

示例2: intersectLineAndCubic

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
/**
 * It checks up if the line (x1, y1) - (x2, y2) and
 * the cubic curve (cx1, cy1) - (cx2, cy2) - (cx3, cy3) - (cx4, cy4). 
 * The points of the intersection is saved to points array. 
 * Therefore the points size must be at learst 6. 
 * @return The method returns the quantity of roots lied in the defined interval 
 */
public static int intersectLineAndCubic(double x1, double y1, double x2, double y2,
                                        double cx1, double cy1, double cx2, double cy2,
                                        double cx3, double cy3, double cx4, double cy4,
                                        double[] params) {
    double[] eqn = new double[4];
    double[] t = new double[3];
    double[] s = new double[3];
    double dy = y2 - y1;
    double dx = x2 - x1;
    int quantity = 0;
    int count = 0;

    eqn[0] = (cy1 - y1) * dx + (x1 - cx1) * dy;
    eqn[1] = - 3 * (cy1 - cy2) * dx + 3 * (cx1 - cx2) * dy ;
    eqn[2] = (3 * cy1 - 6 * cy2 + 3 * cy3) * dx - (3 * cx1 - 6 * cx2 + 3 * cx3) * dy;
    eqn[3] = (- 3 * cy1 + 3 * cy2 - 3 * cy3 + cy4) * dx + 
    		 (3 * cx1 - 3 * cx2 + 3 * cx3 - cx4) * dy;

    if ((count = Crossing.solveCubic(eqn, t)) == 0) {
        return 0;
    }
    
    for (int i = 0; i < count; i++) {
        if (dx != 0) {
            s[i] = (cubic(t[i], cx1, cx2, cx3, cx4) - x1) / dx;
        } else if (dy != 0) {
            s[i] = (cubic(t[i], cy1, cy2, cy3, cy4) - y1) / dy;
        } else {
        	s[i] = 0.0;
        }
        if (t[i] >= 0 && t[i] <= 1 && s[i] >= 0 && s[i] <= 1) {
            params[2 * quantity] = t[i];
            params[2 * quantity + 1] = s[i];
            ++quantity;
        }
    }

    return quantity;
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:47,代码来源:GeometryUtil.java

示例3: isInside

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
/**
 * Checks cross count according to path rule to define is it point inside shape or not. 
 * @param cross - the point cross count
 * @return true if point is inside path, or false otherwise 
 */
boolean isInside(int cross) {
    if (rule == WIND_NON_ZERO) {
        return Crossing.isInsideNonZero(cross);
    }
    return Crossing.isInsideEvenOdd(cross);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:12,代码来源:GeneralPath.java

示例4: intersects

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public boolean intersects(double x, double y, double width, double height) {
	if ((width <= 0.0) || (height <= 0.0)) {
		return false;
	} else if (!getBounds2D().intersects(x, y, width, height)) {
		return false;
	}
	
	int crossCount = Crossing.intersectShape(this, x, y, width, height);
	return Crossing.isInsideEvenOdd(crossCount);
}
 
开发者ID:mike10004,项目名称:appengine-imaging,代码行数:11,代码来源:Area.java

示例5: intersects

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public boolean intersects(double x, double y, double width, double height) {
	if ((width <= 0.0) || (height <= 0.0)) {
		return false;
	} else if (!getBounds2D().intersects(x, y, width, height)) {
		return false;
	}

	int crossCount = Crossing.intersectShape(this, x, y, width, height);
	return Crossing.isInsideEvenOdd(crossCount);
}
 
开发者ID:bullda,项目名称:DroidText,代码行数:11,代码来源:Area.java

示例6: intersectLineAndQuad

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
/**
 * It checks up if there is intersection of the line (x1, y1) - (x2, y2) and
 * the quad curve (qx1, qy1) - (qx2, qy2) - (qx3, qy3). The parameters of
 * the intersection area saved to params array. Therefore the params size
 * must be at learst 4.
 * 
 * @return The method returns the quantity of roots lied in the defined
 *         interval
 */
public static int intersectLineAndQuad(double x1, double y1, double x2, double y2, double qx1, double qy1,
		double qx2, double qy2, double qx3, double qy3, double[] params) {
	double[] eqn = new double[3];
	double[] t = new double[2];
	double[] s = new double[2];
	double dy = y2 - y1;
	double dx = x2 - x1;
	int quantity = 0;
	int count = 0;

	eqn[0] = dy * (qx1 - x1) - dx * (qy1 - y1);
	eqn[1] = 2 * dy * (qx2 - qx1) - 2 * dx * (qy2 - qy1);
	eqn[2] = dy * (qx1 - 2 * qx2 + qx3) - dx * (qy1 - 2 * qy2 + qy3);

	if ((count = Crossing.solveQuad(eqn, t)) == 0) {
		return 0;
	}

	for (int i = 0; i < count; i++) {
		if (dx != 0) {
			s[i] = (quad(t[i], qx1, qx2, qx3) - x1) / dx;
		} else if (dy != 0) {
			s[i] = (quad(t[i], qy1, qy2, qy3) - y1) / dy;
		} else {
			s[i] = 0.0;
		}
		if (t[i] >= 0 && t[i] <= 1 && s[i] >= 0 && s[i] <= 1) {
			params[2 * quantity] = t[i];
			params[2 * quantity + 1] = s[i];
			++quantity;
		}
	}

	return quantity;
}
 
开发者ID:bullda,项目名称:DroidText,代码行数:45,代码来源:GeometryUtil.java

示例7: intersectLineAndCubic

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
/**
 * It checks up if the line (x1, y1) - (x2, y2) and the cubic curve (cx1,
 * cy1) - (cx2, cy2) - (cx3, cy3) - (cx4, cy4). The points of the
 * intersection is saved to points array. Therefore the points size must be
 * at learst 6.
 * 
 * @return The method returns the quantity of roots lied in the defined
 *         interval
 */
public static int intersectLineAndCubic(double x1, double y1, double x2, double y2, double cx1, double cy1,
		double cx2, double cy2, double cx3, double cy3, double cx4, double cy4, double[] params) {
	double[] eqn = new double[4];
	double[] t = new double[3];
	double[] s = new double[3];
	double dy = y2 - y1;
	double dx = x2 - x1;
	int quantity = 0;
	int count = 0;

	eqn[0] = (cy1 - y1) * dx + (x1 - cx1) * dy;
	eqn[1] = -3 * (cy1 - cy2) * dx + 3 * (cx1 - cx2) * dy;
	eqn[2] = (3 * cy1 - 6 * cy2 + 3 * cy3) * dx - (3 * cx1 - 6 * cx2 + 3 * cx3) * dy;
	eqn[3] = (-3 * cy1 + 3 * cy2 - 3 * cy3 + cy4) * dx + (3 * cx1 - 3 * cx2 + 3 * cx3 - cx4) * dy;

	if ((count = Crossing.solveCubic(eqn, t)) == 0) {
		return 0;
	}

	for (int i = 0; i < count; i++) {
		if (dx != 0) {
			s[i] = (cubic(t[i], cx1, cx2, cx3, cx4) - x1) / dx;
		} else if (dy != 0) {
			s[i] = (cubic(t[i], cy1, cy2, cy3, cy4) - y1) / dy;
		} else {
			s[i] = 0.0;
		}
		if (t[i] >= 0 && t[i] <= 1 && s[i] >= 0 && s[i] <= 1) {
			params[2 * quantity] = t[i];
			params[2 * quantity + 1] = s[i];
			++quantity;
		}
	}

	return quantity;
}
 
开发者ID:bullda,项目名称:DroidText,代码行数:46,代码来源:GeometryUtil.java

示例8: contains

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public boolean contains(double px, double py) {
    return isInside(Crossing.crossShape(this, px, py));
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:4,代码来源:GeneralPath.java

示例9: intersects

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public boolean intersects(double rx, double ry, double rw, double rh) {
    int cross = Crossing.intersectShape(this, rx, ry, rw, rh);
    return cross == Crossing.CROSSING || isInside(cross);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:5,代码来源:GeneralPath.java

示例10: contains

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public boolean contains(double px, double py) {
    return Crossing.isInsideEvenOdd(Crossing.crossShape(this, px, py));
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:4,代码来源:QuadCurve2D.java

示例11: intersects

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public boolean intersects(double rx, double ry, double rw, double rh) {
    int cross = Crossing.intersectShape(this, rx, ry, rw, rh);
    return cross == Crossing.CROSSING || Crossing.isInsideEvenOdd(cross);
}
 
开发者ID:dritanlatifi,项目名称:AndroidPrefuse,代码行数:5,代码来源:QuadCurve2D.java

示例12: contains

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public boolean contains(double x, double y) {
    return Crossing.isInsideEvenOdd(Crossing.crossShape(this, x, y));
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:4,代码来源:Polygon.java

示例13: intersects

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public boolean intersects(double x, double y, double width, double height) {
    int cross = Crossing.intersectShape(this, x, y, width, height);
    return cross == Crossing.CROSSING || Crossing.isInsideEvenOdd(cross);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:5,代码来源:Polygon.java

示例14: solveQuadratic

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public static int solveQuadratic(double eqn[], double res[]) {
    return Crossing.solveQuad(eqn, res);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:4,代码来源:QuadCurve2D.java

示例15: solveCubic

import org.apache.harmony.awt.gl.Crossing; //导入依赖的package包/类
public static int solveCubic(double eqn[], double res[]) {
    return Crossing.solveCubic(eqn, res);
}
 
开发者ID:windwardadmin,项目名称:android-awt,代码行数:4,代码来源:CubicCurve2D.java


注:本文中的org.apache.harmony.awt.gl.Crossing类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。