本文整理汇总了Java中java.awt.geom.QuadCurve2D.getY2方法的典型用法代码示例。如果您正苦于以下问题:Java QuadCurve2D.getY2方法的具体用法?Java QuadCurve2D.getY2怎么用?Java QuadCurve2D.getY2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.geom.QuadCurve2D
的用法示例。
在下文中一共展示了QuadCurve2D.getY2方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: evaluate
import java.awt.geom.QuadCurve2D; //导入方法依赖的package包/类
public QuadCurve2D evaluate(QuadCurve2D v0, QuadCurve2D v1,
float fraction)
{
double x1 = v0.getX1() + ((v1.getX1() - v0.getX1()) * fraction);
double y1 = v0.getY1() + ((v1.getY1() - v0.getY1()) * fraction);
double x2 = v0.getX2() + ((v1.getX2() - v0.getX2()) * fraction);
double y2 = v0.getY2() + ((v1.getY2() - v0.getY2()) * fraction);
double ctrlx = v0.getCtrlX() +
((v1.getCtrlX() - v0.getCtrlX()) * fraction);
double ctrly = v0.getCtrlY() +
((v1.getCtrlY() - v0.getCtrlY()) * fraction);
QuadCurve2D value = (QuadCurve2D)v0.clone();
value.setCurve(x1, y1, ctrlx, ctrly, x2, y2);
return value;
}
示例2: evaluate
import java.awt.geom.QuadCurve2D; //导入方法依赖的package包/类
@RegionEffects("reads All")
public QuadCurve2D evaluate(QuadCurve2D v0, QuadCurve2D v1, double fraction) {
double x1 = v0.getX1() + ((v1.getX1() - v0.getX1()) * fraction);
double y1 = v0.getY1() + ((v1.getY1() - v0.getY1()) * fraction);
double x2 = v0.getX2() + ((v1.getX2() - v0.getX2()) * fraction);
double y2 = v0.getY2() + ((v1.getY2() - v0.getY2()) * fraction);
double ctrlx = v0.getCtrlX() + ((v1.getCtrlX() - v0.getCtrlX()) * fraction);
double ctrly = v0.getCtrlY() + ((v1.getCtrlY() - v0.getCtrlY()) * fraction);
QuadCurve2D value = (QuadCurve2D) v0.clone();
value.setCurve(x1, y1, ctrlx, ctrly, x2, y2);
return value;
}
示例3: offsetSubdivided
import java.awt.geom.QuadCurve2D; //导入方法依赖的package包/类
private QuadSegment offsetSubdivided(QuadCurve2D curve, boolean plus)
{
double[] n1 = normal(curve.getX1(), curve.getY1(),
curve.getCtrlX(), curve.getCtrlY());
double[] n2 = normal(curve.getCtrlX(), curve.getCtrlY(),
curve.getX2(), curve.getY2());
Point2D cp;
QuadSegment s;
if(!plus)
{
n1[0] = -n1[0];
n1[1] = -n1[1];
n2[0] = -n2[0];
n2[1] = -n2[1];
}
// Handle special cases where the control point is equal to an end point
// or end points are equal (ie, straight lines)
if (curve.getP1().equals(curve.getCtrlPt()))
{
cp = curve.getCtrlPt();
cp.setLocation(cp.getX() + n2[0], cp.getY() + n2[1]);
n1[0] = n2[0];
n1[1] = n2[1];
}
else if (curve.getP2().equals(curve.getCtrlPt()))
{
cp = curve.getCtrlPt();
cp.setLocation(cp.getX() + n1[0], cp.getY() + n1[1]);
n2[0] = n1[0];
n2[1] = n1[1];
}
else if (curve.getP1().equals(curve.getP2()))
{
cp = curve.getCtrlPt();
double deltaX = curve.getX1() - curve.getCtrlX();
double deltaY = curve.getY1() - curve.getCtrlY();
double length = Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
double ratio = radius / length;
deltaX *= ratio;
deltaY *= ratio;
if (plus)
cp.setLocation(cp.getX() + deltaX, cp.getY() + deltaY);
else
cp.setLocation(cp.getX() - deltaX, cp.getY() - deltaY);
}
else if (n1[0] == n2[0] && n1[1] == n2[1])
{
cp = curve.getCtrlPt();
cp.setLocation(cp.getX() + n1[0], cp.getY() + n1[1]);
}
else
{
cp = lineIntersection(curve.getX1() + n1[0],
curve.getY1() + n1[1],
curve.getCtrlX() + n1[0],
curve.getCtrlY() + n1[1],
curve.getCtrlX() + n2[0],
curve.getCtrlY() + n2[1],
curve.getX2() + n2[0],
curve.getY2() + n2[1], true);
}
s = new QuadSegment(curve.getX1() + n1[0], curve.getY1() + n1[1],
cp.getX(), cp.getY(),
curve.getX2() + n2[0], curve.getY2() + n2[1]);
return s;
}
示例4: offsetSubdivided
import java.awt.geom.QuadCurve2D; //导入方法依赖的package包/类
private QuadSegment offsetSubdivided(QuadCurve2D curve, boolean plus)
{
double[] n1 = normal(curve.getX1(), curve.getY1(),
curve.getCtrlX(), curve.getCtrlY());
double[] n2 = normal(curve.getCtrlX(), curve.getCtrlY(),
curve.getX2(), curve.getY2());
Point2D cp;
QuadSegment s;
if(!plus)
{
n1[0] = -n1[0];
n1[1] = -n1[1];
n2[0] = -n2[0];
n2[1] = -n2[1];
}
// Handle special cases where the control point is equal to an end point
// or end points are equal (ie, straight lines)
if (curve.getP1().equals(curve.getCtrlPt()))
{
cp = curve.getCtrlPt();
cp.setLocation(cp.getX() + n2[0], cp.getY() + n2[1]);
n1[0] = n2[0];
n1[1] = n2[1];
}
else if (curve.getP2().equals(curve.getCtrlPt()))
{
cp = curve.getCtrlPt();
cp.setLocation(cp.getX() + n1[0], cp.getY() + n1[1]);
n2[0] = n1[0];
n2[1] = n1[1];
}
else if (curve.getP1().equals(curve.getP2()))
{
cp = curve.getCtrlPt();
double deltaX = curve.getX1() - curve.getCtrlX();
double deltaY = curve.getY1() - curve.getCtrlY();
double length = Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));
double ratio = radius / length;
deltaX *= ratio;
deltaY *= ratio;
if (plus)
cp.setLocation(cp.getX() + deltaX, cp.getY() + deltaY);
else
cp.setLocation(cp.getX() - deltaX, cp.getY() - deltaY);
}
else if (n1[0] == n2[0] && n1[1] == n2[1])
{
cp = curve.getCtrlPt();
cp.setLocation(cp.getX() + n1[0], cp.getY() + n1[1]);
}
else
{
cp = lineIntersection(curve.getX1() + n1[0],
curve.getY1() + n1[1],
curve.getCtrlX() + n1[0],
curve.getCtrlY() + n1[1],
curve.getCtrlX() + n2[0],
curve.getCtrlY() + n2[1],
curve.getX2() + n2[0],
curve.getY2() + n2[1], true);
}
s = new QuadSegment(curve.getX1() + n1[0], curve.getY1() + n1[1],
cp.getX(), cp.getY(),
curve.getX2() + n2[0], curve.getY2() + n2[1]);
return s;
}