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


Java QuadCurve2D.getY2方法代码示例

本文整理汇总了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;
}
 
开发者ID:mediathekview,项目名称:MediathekView,代码行数:16,代码来源:Evaluator.java

示例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;
}
 
开发者ID:phil-brown,项目名称:javaQuery,代码行数:13,代码来源:EvaluatorQuadCurve2D.java

示例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;
}
 
开发者ID:vilie,项目名称:javify,代码行数:73,代码来源:QuadSegment.java

示例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;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:73,代码来源:QuadSegment.java


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