Examples of rotate()


Examples of java.awt.Graphics2D.rotate()

        protected void paintComponent(Graphics g) {
          Graphics2D g2D = (Graphics2D) g;
          g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
          g2D.translate(getWidth() / 2, getHeight() / 2);
          g2D.scale(getWidth() / 2, getWidth() / 2);
          g2D.rotate(Math.toRadians(controller.getNorthDirectionInDegrees()));
          // Draw a round arc
          g2D.setStroke(new BasicStroke(0.5f / getWidth()));
          g2D.draw(new Ellipse2D.Float(-0.7f, -0.7f, 1.4f, 1.4f));
          g2D.draw(new Line2D.Float(-0.85f, 0, -0.7f, 0));
          g2D.draw(new Line2D.Float(0.85f, 0, 0.7f, 0));
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

            BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
        double angle = Math.atan2(scaleDistancePoints [1][1] - scaleDistancePoints [0][1],
                    scaleDistancePoints [1][0] - scaleDistancePoints [0][0]);
        AffineTransform oldTransform2 = g2D.getTransform();
        g2D.translate(scaleDistancePoints [0][0], scaleDistancePoints [0][1]);
        g2D.rotate(angle);
        Shape endLine = new Line2D.Double(0, 5 / scale, 0, -5 / scale);
        g2D.draw(endLine);
        g2D.setTransform(oldTransform2);
       
        // Draw end point line
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

        g2D.draw(endLine);
        g2D.setTransform(oldTransform2);
       
        // Draw end point line
        g2D.translate(scaleDistancePoints [1][0], scaleDistancePoints [1][1]);
        g2D.rotate(angle);
        g2D.draw(endLine);
        g2D.setTransform(oldTransform);
        g2D.setStroke(oldStroke);
      }
    }
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

          List<Camera> cameraPath = controller.getCameraPath();
          for (int i = 0; i < cameraPath.size(); i++) {
            Camera camera = cameraPath.get(i);
            AffineTransform previousTransform = g2D.getTransform();
            g2D.translate(camera.getX(), camera.getY());
            g2D.rotate(camera.getYaw());
            // Paint camera location
            g2D.fill(ellipse);
            // Paint field of sight angle
            double sin = (float)Math.sin(camera.getFieldOfView() / 2);
            double cos = (float)Math.cos(camera.getFieldOfView() / 2);
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

                break;
            case 3: // 180�
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI);
                g2d.translate(-w*d, -h*d);
                g2d.scale(d, d);
                if ((int)(w*d + .5) < dim.width)
                    xOffset = (int)((dim.width - w*d)/(2.0*d) + 0.5);
                if ((int)(h*d + .5) < dim.height)
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

               break;
            case 4: // 180� + <->
                dx = (double)dim.width / (double)w;
                dy = (double)dim.height / (double)h;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI);
                g2d.translate(0, -h*d);
                g2d.scale(-d, d);
                if ((int)(w*d + .5) < dim.width)
                    xOffset = (int)((dim.width - w*d)/(2.0*d) + 0.5);
                if ((int)(h*d + .5) < dim.height)
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

               break;
            case 5: // -90� + <->
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI/2);
                g2d.scale(d, -d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
                    yOffset = (int)((dim.height - w*d)/(2.0*d) + 0.5);
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

                break;
            case 6: // -90�
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(Math.PI/2);
                g2d.translate(0, -h*d);
                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

                break;
            case 7: // 90� + <->
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(-Math.PI/2);
                g2d.translate(-w*d, h*d);
                g2d.scale(d, -d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
View Full Code Here

Examples of java.awt.Graphics2D.rotate()

                break;
            case 8: // 90�
                dx = (double)dim.width / (double)h;
                dy = (double)dim.height / (double)w;
                d = Math.min(dx, dy);
                g2d.rotate(-Math.PI/2);
                g2d.translate(-w*d, 0);
                g2d.scale(d, d);
                if ((int)(h*d + .5) < dim.width)
                    xOffset = (int)((dim.width - h*d)/(2.0*d) + 0.5);
                if ((int)(w*d + .5) < dim.height)
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.