當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。