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


Java CubicCurve2D.getX1方法代码示例

本文整理汇总了Java中java.awt.geom.CubicCurve2D.getX1方法的典型用法代码示例。如果您正苦于以下问题:Java CubicCurve2D.getX1方法的具体用法?Java CubicCurve2D.getX1怎么用?Java CubicCurve2D.getX1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.geom.CubicCurve2D的用法示例。


在下文中一共展示了CubicCurve2D.getX1方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNearestPointOnCurve

import java.awt.geom.CubicCurve2D; //导入方法依赖的package包/类
@Override
public Point2D getNearestPointOnCurve(Point2D pt) {
    // FIXME: should be done using some proper algorithm
    CubicCurve2D curve = getCurve();
    Point2D nearest = new Point2D.Double(curve.getX1(), curve.getY1());
    double nearestDist = Double.MAX_VALUE;

    for (double t = 0.01; t <= 1.0; t += 0.01) {
        Point2D samplePoint = Geometry.getPointOnCubicCurve(curve, t);
        double distance = pt.distance(samplePoint);
        if (distance < nearestDist) {
            nearestDist = distance;
            nearest = samplePoint;
        }
    }

    return nearest;
}
 
开发者ID:workcraft,项目名称:workcraft,代码行数:19,代码来源:Bezier.java

示例2: 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);
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:25,代码来源:BezierUtils.java

示例3: 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);
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:14,代码来源:Circle.java

示例4: 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();
}
 
开发者ID:Audiveris,项目名称:audiveris,代码行数:12,代码来源:Jaxb.java

示例5: 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());
}
 
开发者ID:Banno,项目名称:sbt-plantuml-plugin,代码行数:5,代码来源:DotPath.java


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