本文整理汇总了Java中java.awt.geom.CubicCurve2D.getCtrlX2方法的典型用法代码示例。如果您正苦于以下问题:Java CubicCurve2D.getCtrlX2方法的具体用法?Java CubicCurve2D.getCtrlX2怎么用?Java CubicCurve2D.getCtrlX2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.CubicCurve2D
的用法示例。
在下文中一共展示了CubicCurve2D.getCtrlX2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: subdivide
import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
private 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 x1 = src.getX1();
final double y1 = src.getY1();
final double x2 = src.getX2();
final double y2 = src.getY2();
final double ctrlx1 = x1 * coef1 + src.getCtrlX1() * coef1;
final double ctrly1 = y1 * coef1 + src.getCtrlY1() * coef1;
final double ctrlx2 = x2 * coef1 + src.getCtrlX2() * coef1;
final double ctrly2 = y2 * 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(x1, y1, ctrlx1, ctrly1, ctrlx12, ctrly12, centerxB, centeryB);
right.setCurve(centerxB, centeryB, ctrlx21, ctrly21, ctrlx2, ctrly2, x2, y2);
}
示例2: getMiddlePoint
import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
/**
* Report the half-way point on Bézier curve.
*
* @return the middle of the curve arc
*/
public Point2D getMiddlePoint ()
{
CubicCurve2D c = getCurve();
return new Point2D.Double(
(c.getX1() + (3 * c.getCtrlX1()) + (3 * c.getCtrlX2()) + c.getX2()) / 8,
(c.getY1() + (3 * c.getCtrlY1()) + (3 * c.getCtrlY2()) + c.getY2()) / 8);
}
示例3: CubicFacade
import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
public CubicFacade (CubicCurve2D curve)
{
this.x1 = curve.getX1();
this.y1 = curve.getY1();
this.ctrlx1 = curve.getCtrlX1();
this.ctrly1 = curve.getCtrlY1();
this.ctrlx2 = curve.getCtrlX2();
this.ctrly2 = curve.getCtrlY2();
this.x2 = curve.getX2();
this.y2 = curve.getY2();
}
示例4: reverse
import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
public static CubicCurve2D.Double reverse(CubicCurve2D curv) {
return new CubicCurve2D.Double(curv.getX2(), curv.getY2(), curv.getCtrlX2(), curv.getCtrlY2(),
curv.getCtrlX1(), curv.getCtrlY1(), curv.getX1(), curv.getY1());
}