Java 8 CubicCurve2D - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 CubicCurve2D class.

This code example shows how to use the following methods:getCtrlX1, getCtrlX2, getCtrlY1, getCtrlY2, getX1
	} 
 
	public static void subdivide(CubicCurve2D src, CubicCurve2D left, CubicCurve2D right, final double coef) {
		final double coef1 = coef;
		final double coef2 = 1 - coef;
		final double centerxA = src.getCtrlX1() * coef1 + src.getCtrlX2() * coef2;
		final double centeryA = src.getCtrlY1() * coef1 + src.getCtrlY2() * coef2;
 
		final double ctrlx1 = src.getX1() * coef1 + src.getCtrlX1() * coef1;
		final double ctrly1 = src.getY1() * coef1 + src.getCtrlY1() * coef1;
		final double ctrlx2 = src.getX2() * coef1 + src.getCtrlX2() * coef1;
		final double ctrly2 = src.getY2() * coef1 + src.getCtrlY2() * coef1;
 
		final double ctrlx12 = ctrlx1 * coef1 + centerxA * coef1;
		final double ctrly12 = ctrly1 * coef1 + centeryA * coef1;
		final double ctrlx21 = ctrlx2 * coef1 + centerxA * coef1;
		final double ctrly21 = ctrly2 * coef1 + centeryA * coef1;
		final double centerxB = ctrlx12 * coef1 + ctrlx21 * coef1;
		final double centeryB = ctrly12 * coef1 + ctrly21 * coef1;
		left.setCurve(src.getX1(), src.getY1(), ctrlx1, ctrly1, ctrlx12, ctrly12, centerxB, centeryB);

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getBounds
        float dx = x2-x1;
        float dy = y2-y1;
        float thetaRadians = (float) Math.atan2(dy, dx);
        xform.rotate(thetaRadians);
        float dist = (float) Math.sqrt(dx*dx + dy*dy);
        xform.scale(dist / rawEdge.getBounds().getWidth(), 1.0);
        edgeShape = xform.createTransformedShape(rawEdge);
    } 
     
    private void transformArrowShape(Point2D down, Point2D out) {
        float x1 = (float) down.getX();
        float y1 = (float) down.getY();
        float x2 = (float) out.getX();
        float y2 = (float) out.getY();
 
        AffineTransform xform = AffineTransform.getTranslateInstance(x2, y2);
         
        float dx = x2-x1;
        float dy = y2-y1;
        float thetaRadians = (float) Math.atan2(dy, dx);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 CubicCurve2D Methods: