List of usage examples for java.lang Math PI
double PI
To view the source code for java.lang Math PI.
Click Source Link
From source file:Main.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; AffineTransform at = new AffineTransform(); at.setToShear(Math.PI / 6, Math.PI / 6); g2.setTransform(at);//from ww w . j a v a2 s . c om g2.draw(shape); }
From source file:Main.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; AffineTransform at = new AffineTransform(); at.setToRotation(Math.PI / 6, Math.PI / 6); at.translate(100, 0);// ww w . j av a 2 s . com g2.setTransform(at); g2.draw(shape); }
From source file:Main.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; AffineTransform at = new AffineTransform(); at.setToTranslation(Math.PI / 6, Math.PI / 6); g2.setTransform(at);/*from ww w . jav a 2 s . c o m*/ g2.draw(shape); }
From source file:Draw2DRotate.java
public void paint(Graphics graphics) { Graphics2D g = (Graphics2D) graphics; AffineTransform transform = AffineTransform.getRotateInstance(Math.PI / 16.0d); g.setTransform(transform);/*from www . j a va 2s. c o m*/ Line2D.Double shape = new Line2D.Double(0.0, 0.0, 300.0, 300.0); g.draw(shape); g.setFont(new Font("Helvetica", Font.BOLD, 24)); String text = ("Java2s"); g.drawString(text, 300, 50); Toolkit toolkit = Toolkit.getDefaultToolkit(); Image image = toolkit.getImage("image1.gif"); g.drawImage(image, 100, 150, this); }
From source file:MainClass.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; AffineTransform at = new AffineTransform(); at.setToRotation(Math.PI / 6); at.translate(100, 0);//w w w. j a v a 2s.co m g2.setTransform(at); g2.draw(shape); }
From source file:Main.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; AffineTransform at = new AffineTransform(); at.setToRotation(0.2, Math.PI / 6, Math.PI / 6); at.translate(100, 0);//from w w w .jav a 2s .co m g2.setTransform(at); g2.draw(shape); }
From source file:Main.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; AffineTransform at = new AffineTransform(); at.setToRotation(0.2, 0.2, Math.PI / 6, Math.PI / 6); at.translate(100, 0);//from w w w. j av a2 s.co m g2.setTransform(at); g2.draw(shape); }
From source file:MainClass.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; float cm = 72 / 2.54f; AffineTransform at = AffineTransform.getRotateInstance(-Math.PI / 6, 3 * cm, 2 * cm); g2.setTransform(at);//from w ww . j a v a 2s . c o m g2.draw(shape); }
From source file:Main.java
static double distanceFromPointOnArc(double dA, double dB, double dAB) { // In spherical trinagle ABC // a is length of arc BC, that is dB // b is length of arc AC, that is dA // c is length of arc AB, that is dAB // We rename parameters so following formulas are more clear: double a = dB; double b = dA; double c = dAB; // First, we calculate angles alpha and beta in spherical triangle ABC // and based on them we decide how to calculate the distance: if (Math.sin(b) * Math.sin(c) == 0.0 || Math.sin(c) * Math.sin(a) == 0.0) { // It probably means that one of distance is n*pi, which gives around 20000km for n = 1, // unlikely for Denmark, so we should be fine. return -1.0; }/*from w w w . java 2 s. c o m*/ double alpha = Math.acos((Math.cos(a) - Math.cos(b) * Math.cos(c)) / (Math.sin(b) * Math.sin(c))); double beta = Math.acos((Math.cos(b) - Math.cos(c) * Math.cos(a)) / (Math.sin(c) * Math.sin(a))); // It is possible that both sinuses are too small so we can get nan when dividing with them if (Double.isNaN(alpha) || Double.isNaN(beta)) { return -1.0; } // If alpha or beta are zero or pi, it means that C is on the same circle as arc AB, // we just need to figure out if it is between AB: if (alpha == 0.0 || beta == 0.0) { return (dA + dB > dAB) ? Math.min(dA, dB) : 0.0; } // If alpha is obtuse and beta is acute angle, then // distance is equal to dA: if (alpha > Math.PI / 2 && beta < Math.PI / 2) return -1; // Analogously, if beta is obtuse and alpha is acute angle, then // distance is equal to dB: if (beta > Math.PI / 2 && alpha < Math.PI / 2) return -1; // Again, unlikely, since it would render at least pi/2*EARTH_RADIUS_IN_METERS, which is too much. if (Math.cos(a) == 0.0) return -1; double x = Math.atan(-1.0 / Math.tan(c) + (Math.cos(b) / (Math.cos(a) * Math.sin(c)))); return x; }
From source file:Reportes.ChartCustomizer.java
@Override public void customize(JFreeChart chart, ReportParameters reportParameters) { CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2)); }