Examples of Line2D


Examples of java.awt.geom.Line2D

            Rectangle2D bounds = new Rectangle2D.Double(0, 0, w, h);
            double midX = w / 2d;
            double midY = h / 2d;

            InfiniteLine line;
            Line2D l;
            double normal = angle + Math.PI / 2;
            double x, y;
            int n;

            n = 0;
View Full Code Here

Examples of java.awt.geom.Line2D

        GeneralPath path = new GeneralPath();
        for (double t=start; t<=end; t+=inc) {
            double newX = xNum.evaluate(t) / xDen.evaluate(t);
            double newY = yNum.evaluate(t) / yDen.evaluate(t);
            Line2D line = new Line2D.Double(oldX, oldY, newX, newY);
            path.append(line, true);
            oldX = newX;
            oldY = newY;
        }
        return path;
View Full Code Here

Examples of java.awt.geom.Line2D

    Line2D getSegment(Rectangle2D rect) {
        if (isMoreHorizontal) {
            double x1 = rect.getX();
            double x2 = rect.getX() + rect.getWidth();
            Line2D line = getHorizontalSegment(x1, x2);
            if (rect.intersectsLine(line)) {
                return line;
            }
        }
        else {
            double y1 = rect.getY();
            double y2 = rect.getY() + rect.getHeight();
            Line2D line = getVerticalSegment(y1, y2);
            if (rect.intersectsLine(line)) {
                return line;
            }
        }
        return null;
View Full Code Here

Examples of math.geom2d.line.Line2D

      if (dockersNode.size() == 2) {
        nextPointInLineX += targetInfo.getX();
        nextPointInLineY += targetInfo.getY();
      }
     
      Line2D firstLine = new Line2D(sourceRefLineX, sourceRefLineY, nextPointInLineX, nextPointInLineY);
     
      String sourceRefStencilId = BpmnJsonConverterUtil.getStencilId(sourceRefNode);
      String targetRefStencilId = BpmnJsonConverterUtil.getStencilId(targetRefNode);
     
      List<Point> graphicInfoList = new ArrayList<Point>();
     
      if (DI_CIRCLES.contains(sourceRefStencilId)) {
        Circle2D eventCircle = new Circle2D(sourceInfo.getX() + sourceDockersX,
            sourceInfo.getY() + sourceDockersY, sourceDockersX);
       
        Collection<Point2D> intersections = eventCircle.intersections(firstLine);
        Point2D intersection = intersections.iterator().next();
        graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
     
      } else if (DI_RECTANGLES.contains(sourceRefStencilId)) {
        Polyline2D rectangle = createRectangle(sourceInfo);
       
        Collection<Point2D> intersections = rectangle.intersections(firstLine);
        Point2D intersection = intersections.iterator().next();
        graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
     
      } else if (DI_GATEWAY.contains(sourceRefStencilId)) {
        Polyline2D gatewayRectangle = createGateway(sourceInfo);
       
        Collection<Point2D> intersections = gatewayRectangle.intersections(firstLine);
        Point2D intersection = intersections.iterator().next();
        graphicInfoList.add(createGraphicInfo(intersection.getX(), intersection.getY()));
      }
     
      Line2D lastLine = null;
     
      if (dockersNode.size() > 2) {
        for(int i = 1; i < dockersNode.size() - 1; i++) {
          double x = dockersNode.get(i).get(EDITOR_BOUNDS_X).getDoubleValue();
          double y = dockersNode.get(i).get(EDITOR_BOUNDS_Y).getDoubleValue();
          graphicInfoList.add(createGraphicInfo(x, y));
        }
       
        double startLastLineX = dockersNode.get(dockersNode.size() - 2).get(EDITOR_BOUNDS_X).getDoubleValue();
        double startLastLineY = dockersNode.get(dockersNode.size() - 2).get(EDITOR_BOUNDS_Y).getDoubleValue();
       
        double endLastLineX = dockersNode.get(dockersNode.size() - 1).get(EDITOR_BOUNDS_X).getDoubleValue();
        double endLastLineY = dockersNode.get(dockersNode.size() - 1).get(EDITOR_BOUNDS_Y).getDoubleValue();
       
        endLastLineX += targetInfo.getX();
        endLastLineY += targetInfo.getY();
       
        lastLine = new Line2D(startLastLineX, startLastLineY, endLastLineX, endLastLineY);
       
      } else {
        lastLine = firstLine;
      }
     
View Full Code Here

Examples of org.codemap.util.geom.Line2D

        Shape shape = edge.getShape();
        if ((shape == null) || !(shape instanceof Line2D)) {
            shape = new Line2D.Double(n1.getLocation(), n2.getLocation());
            edge.setShape(shape);
        } else {
            Line2D line = (Line2D)shape;
            line.setLine(n1.getLocation(), n2.getLocation());
            //System.out.println(n1.getLocation() + ", " + n2.getLocation());
        }
       
        return displayWidth;
    }   
View Full Code Here

Examples of toxi.geom.Line2D

    }

    public void apply(ToxiclibsSupport gfx, ReadonlyVec2D a, ReadonlyVec2D b) {
        int i = 0;
        Vec2D prev = null;
        for (Vec2D p : new Line2D(a, b).splitIntoSegments(null, length, true)) {
            if (i % 2 == 0) {
                prev = p;
            } else {
                gfx.line(prev, p);
            }
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.