Examples of Curve


Examples of ae.sun.awt.geom.Curve

            return true;
        }
        if (size > 3) {
            return false;
        }
        Curve c1 = (Curve) curves.get(1);
        Curve c2 = (Curve) curves.get(2);
        if (c1.getOrder() != 1 || c2.getOrder() != 1) {
            return false;
        }
        if (c1.getXTop() != c1.getXBot() || c2.getXTop() != c2.getXBot()) {
            return false;
        }
        if (c1.getYTop() != c2.getYTop() || c1.getYBot() != c2.getYBot()) {
            // One might be able to prove that this is impossible...
            return false;
        }
        return true;
    }
View Full Code Here

Examples of ae.sun.awt.geom.Curve

        if (cachedBounds != null) {
            return cachedBounds;
        }
        Rectangle2D r = new Rectangle2D.Double();
        if (curves.size() > 0) {
            Curve c = (Curve) curves.get(0);
            // First point is always an order 0 curve (moveto)
            r.setRect(c.getX0(), c.getY0(), 0, 0);
            for (int i = 1; i < curves.size(); i++) {
                ((Curve) curves.get(i)).enlarge(r);
            }
        }
        return (cachedBounds = r);
View Full Code Here

Examples of ae.sun.awt.geom.Curve

            return false;
        }
        Enumeration enum_ = curves.elements();
        int crossings = 0;
        while (enum_.hasMoreElements()) {
            Curve c = (Curve) enum_.nextElement();
            crossings += c.crossingsFor(x, y);
        }
        return ((crossings & 1) == 1);
    }
View Full Code Here

Examples of com.ardor3d.spline.Curve

        };

        final List<ReadOnlyVector3> controls = Arrays.asList(vectors);

        // Create our curve from the control points and a spline
        final Curve curve = new Curve(controls, new CatmullRomSpline());

        // Create a line from the curve so its easy to check the box is following it
        final Line line = curve.toRenderableLine(10);

        if (loop) {
            line.getMeshData().setIndexMode(IndexMode.LineLoop);
        }
View Full Code Here

Examples of com.cburch.draw.shapes.Curve

    int ry = OFFS + (9 - (ay + 9) % 10);
   
    Location e0 = Location.create(rx + (width - 8) / 2, ry + 1);
    Location e1 = Location.create(rx + (width + 8) / 2, ry + 1);
    Location ct = Location.create(rx + width / 2, ry + 11);
    Curve notch = new Curve(e0, e1, ct);
    notch.setValue(DrawAttr.STROKE_WIDTH, Integer.valueOf(2));
    notch.setValue(DrawAttr.STROKE_COLOR, Color.GRAY);
    Rectangle rect = new Rectangle(rx, ry, width, height);
    rect.setValue(DrawAttr.STROKE_WIDTH, Integer.valueOf(2));

    List<CanvasObject> ret = new ArrayList<CanvasObject>();
    ret.add(notch);
View Full Code Here

Examples of com.cburch.draw.shapes.Curve

      end0 = Location.create(mx, my);
      end1 = end0;
      state = ENDPOINT_DRAG;
      break;
    case ENDPOINT_DRAG:
      curCurve = new Curve(end0, end1, Location.create(mx, my));
      state = CONTROL_DRAG;
      break;
    }
    repaintArea(canvas);
  }
View Full Code Here

Examples of com.cburch.draw.shapes.Curve

    repaintArea(canvas);
  }
 
  @Override
  public void mouseReleased(Canvas canvas, MouseEvent e) {
    Curve c = updateMouse(canvas, e.getX(), e.getY(), e.getModifiersEx());
    mouseDown = false;
    if (state == CONTROL_DRAG) {
      if (c != null) {
        attrs.applyTo(c);
        CanvasModel model = canvas.getModel();
View Full Code Here

Examples of com.cburch.draw.shapes.Curve

    lastMouseY = my;
   
    boolean shiftDown = (mods & MouseEvent.SHIFT_DOWN_MASK) != 0;
    boolean ctrlDown = (mods & MouseEvent.CTRL_DOWN_MASK) != 0;
    boolean altDown = (mods & MouseEvent.ALT_DOWN_MASK) != 0;
    Curve ret = null;
    switch (state) {
    case ENDPOINT_DRAG:
      if (mouseDown) {
        if (shiftDown) {
          Location p = LineUtil.snapTo8Cardinals(end0, mx, my);
          mx = p.getX();
          my = p.getY();
        }
        if (ctrlDown) {
          mx = canvas.snapX(mx);
          my = canvas.snapY(my);
        }
        end1 = Location.create(mx, my);
      }
      break;
    case CONTROL_DRAG:
      if (mouseDown) {
        int cx = mx;
        int cy = my;
        if (ctrlDown) {
          cx = canvas.snapX(cx);
          cy = canvas.snapY(cy);
        }
        if (shiftDown) {
          double x0 = end0.getX();
          double y0 = end0.getY();
          double x1 = end1.getX();
          double y1 = end1.getY();
          double midx = (x0 + x1) / 2;
          double midy = (y0 + y1) / 2;
          double dx = x1 - x0;
          double dy = y1 - y0;
          double[] p = LineUtil.nearestPointInfinite(cx, cy,
              midx, midy, midx - dy, midy + dx);
          cx = (int) Math.round(p[0]);
          cy = (int) Math.round(p[1]);
        }
        if (altDown) {
          double[] e0 = { end0.getX(), end0.getY() };
          double[] e1 = { end1.getX(), end1.getY() };
          double[] mid = { cx, cy };
          double[] ct = CurveUtil.interpolate(e0, e1, mid);
          cx = (int) Math.round(ct[0]);
          cy = (int) Math.round(ct[1]);
        }
        ret = new Curve(end0, end1, Location.create(cx, cy));
        curCurve = ret;
      }
      break;
    }
    return ret;
View Full Code Here

Examples of com.cburch.draw.shapes.Curve

        int ry = OFFS + (9 - (ay + 9) % 10);

        Location e0 = Location.create(rx + (width - 8) / 2, ry + 1);
        Location e1 = Location.create(rx + (width + 8) / 2, ry + 1);
        Location ct = Location.create(rx + width / 2, ry + 11);
        Curve notch = new Curve(e0, e1, ct);
        notch.setValue(DrawAttr.STROKE_WIDTH, Integer.valueOf(2));
        notch.setValue(DrawAttr.STROKE_COLOR, Color.GRAY);
        Rectangle rect = new Rectangle(rx, ry, width, height);
        rect.setValue(DrawAttr.STROKE_WIDTH, Integer.valueOf(2));

        List<CanvasObject> ret = new ArrayList<CanvasObject>();
        ret.add(notch);
View Full Code Here

Examples of com.cburch.draw.shapes.Curve

            end0 = Location.create(mx, my);
            end1 = end0;
            state = ENDPOINT_DRAG;
            break;
        case ENDPOINT_DRAG:
            curCurve = new Curve(end0, end1, Location.create(mx, my));
            state = CONTROL_DRAG;
            break;
        default:
          break;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.