コード例 #1
0
ファイル: TreePreview.java プロジェクト: rmichela/GiantTrees
  private void drawLine(Graphics g, Vector p, Vector q) {
    // FIXME: maybe eliminate class instantiations
    // from this method for performance reasons:
    // use static point arrays for transformations

    Vector u = rotation.apply(p.sub(origin));
    Vector v = rotation.apply(q.sub(origin));

    Point2D.Double from = new Point2D.Double(u.getX(), u.getZ());
    Point2D.Double to = new Point2D.Double(v.getX(), v.getZ());

    Point ifrom = new Point();
    Point ito = new Point();

    transform.transform(from, ifrom);
    transform.transform(to, ito);

    //		g.drawLine(xInt(u.getX()),yInt(u.getZ()),
    //				xInt(v.getX()),yInt(v.getZ()));

    g.drawLine(ifrom.x, ifrom.y, ito.x, ito.y);
  }