Example usage for java.lang Math asin

List of usage examples for java.lang Math asin

Introduction

In this page you can find the example usage for java.lang Math asin.

Prototype

public static double asin(double a) 

Source Link

Document

Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2.

Usage

From source file:com.mapr.synth.drive.GeoPoint.java

public double distance(GeoPoint x) {
    // the dot product could also be used here, but we expect small distances mostly
    // so the haversine formulation is more accurate
    return Constants.EARTH_RADIUS_KM * 2 * Math.asin(r.subtract(x.r).getNorm() / 2);
}

From source file:net.nicoulaj.benchmarks.math.DoubleAsin.java

@GenerateMicroBenchmark
public void math(BlackHole hole) {
    for (int i = 0; i < data.length - 1; i++)
        hole.consume(Math.asin(data[i]));
}

From source file:org.netxilia.functions.MathFunctions.java

public double ASIN(double number) {
    return Math.asin(number);
}

From source file:com.example.blockcanary_demo.DemoFragment.java

private static double compute() {
    double result = 0;
    for (int i = 0; i < 1000000; ++i) {
        result += Math.acos(Math.cos(i));
        result -= Math.asin(Math.sin(i));
    }//from   ww  w . j a va  2 s . co m
    return result;
}

From source file:org.hbird.business.navigation.processors.orekit.EclipseCalculator.java

public static double calculateEclipse(SpacecraftState s) throws OrekitException {
    double occultedRadius = Constants.EQUATORIAL_RADIUS_OF_SUN;
    double occultingRadius = Constants.EQUATORIAL_RADIUS_OF_THE_EARTH;
    final Vector3D pted = CelestialBodyFactory.getSun().getPVCoordinates(s.getDate(), s.getFrame())
            .getPosition();//from ww  w. jav a  2  s  .c  o m
    final Vector3D ping = CelestialBodyFactory.getEarth().getPVCoordinates(s.getDate(), s.getFrame())
            .getPosition();
    final Vector3D psat = s.getPVCoordinates().getPosition();
    final Vector3D ps = pted.subtract(psat);
    final Vector3D po = ping.subtract(psat);
    final double angle = Vector3D.angle(ps, po);
    final double rs = Math.asin(occultedRadius / ps.getNorm());
    final double ro = Math.asin(occultingRadius / po.getNorm());
    return angle - ro - rs;
}

From source file:com.autodomum.daylight.algorithm.DaylightAlgorithm.java

/**
 * Calculate length of the day for a specific day
 * /*from   ww  w.jav a 2 s  . co  m*/
 * @param latitude
 *            the latitude
 * @param day
 *            the day
 * @return time in hours
 */
public double length(double latitude, int day) {

    final double p = Math
            .asin(.39795 * Math.cos(.2163108 + 2 * Math.atan(.9671396 * Math.tan(.00860 * (day - 186)))));

    return (24.0d - (24.0d / Math.PI) * Math
            .acos((Math.sin(0.8333d * Math.PI / 180d) + Math.sin(latitude * Math.PI / 180.0d) * Math.sin(p))
                    / (Math.cos(latitude * Math.PI / 180.0d) * Math.cos(p))));
}

From source file:jtrace.texture.TransparentFinish.java

/**
 * Obtain ray refracted according to Snell's law.
 * /*from   ww w .j  a  v a 2s. co m*/
 * @param incidentRay
 * @param normalRay
 * @return refracted ray
 */
Ray getRefractedRay(Ray incidentRay, Ray normalRay) {

    // Check direction of incident ray (inside to out or outside to in)
    // and adjust ior accordingly:
    double snellFactor;
    Vector3D axis;
    if (incidentRay.direction.dotProduct(normalRay.direction) < 0.0) {
        snellFactor = 1.0 / ior;
        axis = incidentRay.direction.crossProduct(normalRay.direction);
    } else {
        snellFactor = ior;
        axis = normalRay.direction.crossProduct(incidentRay.direction);
    }

    if (axis.getNorm() > 0) {
        axis = axis.normalize();
    } else {
        return new Ray(normalRay.getOrigin(), incidentRay.direction);
    }

    double angle = Math
            .asin((incidentRay.direction.normalize().crossProduct(normalRay.direction).normalize()).getNorm());
    double newAngle = Math.asin(snellFactor * Math.sin(angle));

    Rotation rotation = new Rotation(axis, newAngle - angle);

    Vector3D refractedDir = rotation.applyTo(incidentRay.direction);

    return new Ray(normalRay.getOrigin(), refractedDir);
}

From source file:org.esa.beam.util.math.FastMathTest.java

@Test
public void testMathASin() {
    for (double i = 0; i < numItr; ++i) {
        double val = Math.asin(i);
    }//from  w w  w  .ja  va 2s . c  om
}

From source file:org.gearvrf.GVRInternalSensorListener.java

/**
 * Finds the missing value. Seems to lose a degree of freedom, but it
 * doesn't. That degree of freedom is already lost by the sensor.
 */// w ww  . jav a 2  s .com
private float getQuaternionW(float x, float y, float z) {
    return (float) Math.cos(Math.asin(Math.sqrt(x * x + y * y + z * z)));
}

From source file:com.duy.pascal.interperter.libraries.math.MathLib.java

@PascalMethod(description = "Return inverse sine")
public double ArcSin(double d) {
    return Math.asin(d);
}