Example usage for java.lang StrictMath toDegrees

List of usage examples for java.lang StrictMath toDegrees

Introduction

In this page you can find the example usage for java.lang StrictMath toDegrees.

Prototype

public static strictfp double toDegrees(double angrad) 

Source Link

Document

Converts an angle measured in radians to an approximately equivalent angle measured in degrees.

Usage

From source file:Main.java

public static void main(String[] args) {

    double d1 = 1.5707963267948966, d2 = 0.0;

    System.out.println("Degree value of d1 : " + StrictMath.toDegrees(d1));

    System.out.println("Degree value of d2 : " + StrictMath.toDegrees(d2));
}

From source file:gis.proj.drivers.Snyder.java

public static void main(String... args) {
    Snyder snyder = new Snyder();
    JCommander jc = new JCommander(snyder);

    try {/* www .  j a v  a  2  s . com*/
        jc.parse(args);
    } catch (Exception e) {
        jc.usage();
        System.exit(-10);
    }

    String fFormat = "(forward)   X: %18.9f,   Y: %18.9f%n";
    String iFormat = "(inverse) Lon: %18.9f, Lat: %18.9f%n%n";

    double[][] xy, ll = null;

    java.util.regex.Pattern pq = java.util.regex.Pattern.compile("quit",
            java.util.regex.Pattern.CASE_INSENSITIVE);
    java.util.Scanner s = new java.util.Scanner(System.in);

    Projection proj = null;

    printLicenseInformation("Snyder");

    try {
        System.out.println("Loading projection: " + snyder.projStr);
        Class<?> cls = Class.forName(snyder.projStr);
        proj = (Projection) cls.newInstance();
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    double lon = 0.0, lat = 0.0, x = 0.0, y = 0.0;

    Datum d = new Datum();
    Ellipsoid e = EllipsoidFactory.getInstance().getEllipsoid(snyder.ellpStr);
    System.out.println("\nEllipsoid: " + snyder.ellpStr + ", " + e.getName() + ", " + e.getId() + ", "
            + e.getDescription());

    for (String prop : e.getPropertyNames()) {
        System.out.println("\t" + prop + "\t" + e.getProperty(prop));
    }

    String cmdEntryLine = (snyder.inverse ? "\nx y " : "\nlon lat") + ": ";

    for (String dProp : proj.getDatumProperties()) {
        d.setUserOverrideProperty(dProp, 0.0);
    }
    System.out.print(cmdEntryLine);

    while (s.hasNext(pq) == false) {
        if (snyder.inverse == false) {
            lon = parseDatumVal(s.next());
            lat = parseDatumVal(s.next());
        } else {
            x = parseDatumVal(s.next());
            y = parseDatumVal(s.next());
        }

        for (String dp : d.getPropertyNames()) {
            System.out.print(dp + ": ");
            d.setUserOverrideProperty(dp, parseDatumVal(s.next()));
        }

        System.out.println();

        if (snyder.inverse == false) {
            xy = proj.forward(new double[] { lon }, new double[] { lat }, e, d);

            System.out.printf(fFormat, xy[0][0], xy[1][0]);

            ll = proj.inverse(new double[] { xy[0][0] }, new double[] { xy[1][0] }, e, d);

            System.out.printf(iFormat, StrictMath.toDegrees(ll[0][0]), StrictMath.toDegrees(ll[1][0]));
        } else {
            ll = proj.inverse(new double[] { x }, new double[] { y }, e, d);

            System.out.printf(iFormat, StrictMath.toDegrees(ll[0][0]), StrictMath.toDegrees(ll[1][0]));

            xy = proj.forward(new double[] { ll[0][0] }, new double[] { ll[1][0] }, e, d);

            System.out.printf(fFormat, xy[0][0], xy[1][0]);
        }

        System.out.print(cmdEntryLine);
    }

    s.close();
}

From source file:org.pentaho.plugin.jfreereport.reportcharts.CategoricalChartExpression.java

public Double getLabelRotationDeg() {
    if (labelRotation == null) {
        return null;
    } else {//w w w . j a  va2s  .c  om
        return new Double(StrictMath.toDegrees(labelRotation.doubleValue()));
    }
}

From source file:org.pentaho.plugin.jfreereport.reportcharts.CategoricalChartExpression.java

public Double getCategoricalItemLabelRotationDeg() {
    if (categoricalItemLabelRotation == null) {
        return null;
    } else {/*from   ww  w . j av  a 2s .  c om*/
        return new Double(StrictMath.toDegrees(categoricalItemLabelRotation.doubleValue()));
    }
}