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.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java

@Test
public void asinNinety() {
    try {/*from ww w. j  av a 2s .  c o  m*/
        Expression expression = getExpressionWithFunctionContext("asin(90)");
        assertEquals(ExpressionType.DOUBLE, expression.getExpressionType());
        assertEquals(Math.asin(90), expression.evaluateNumerical(), 1e-15);
    } catch (ExpressionException e) {
        assertNotNull(e.getMessage());
    }
}

From source file:com.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java

@Test
public void asinPi() {
    try {//  w  w  w  . jav  a  2  s.  c o  m
        Expression expression = getExpressionWithFunctionContext("asin(pi)");
        assertEquals(ExpressionType.DOUBLE, expression.getExpressionType());
        assertEquals(Math.asin(Math.PI), expression.evaluateNumerical(), 1e-15);
    } catch (ExpressionException e) {
        assertNotNull(e.getMessage());
    }
}

From source file:com.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java

@Test
public void asinPiHalf() {
    try {//from  ww w  . j  av  a 2s  . c  o  m
        Expression expression = getExpressionWithFunctionContext("asin(pi/2)");
        assertEquals(ExpressionType.DOUBLE, expression.getExpressionType());
        assertEquals(Math.asin(Math.PI / 2), expression.evaluateNumerical(), 1e-15);
    } catch (ExpressionException e) {
        assertNotNull(e.getMessage());
    }
}

From source file:org.jrman.parser.Parser.java

public void addSphere(final float radius, float zMin, float zMax, float tMax, final ParameterList parameters) {
    if (inAreaLightSource)
        return;//ww  w . j a va2 s  . c  o m
    final float phiMin = (float) ((zMin <= -radius) ? -Math.PI / 2 : Math.asin(zMin / radius));
    final float phiMax = (float) ((zMax >= radius) ? Math.PI / 2 : Math.asin(zMax / radius));
    final float thetaMin = 0f;
    final float thetaMax = (float) Math.toRadians(tMax);
    if (!inObject) {
        renderer.addPrimitive(
                new Sphere(radius, phiMin, phiMax, thetaMin, thetaMax, parameters, getAttributes()));
        sphereCount++;
    } else {
        final Transform transform = currentAttributes.getTransform();
        currentObjectInstanceList.addPrimitiveCreator(new ObjectInstanceList.PrimitiveCreator() {
            public Primitive create(Attributes attributes) {
                sphereCount++;
                return new Sphere(radius, phiMin, phiMax, thetaMin, thetaMax, parameters,
                        createAttributes(transform, attributes));
            }
        });
    }
}

From source file:com.rapidminer.tools.expression.internal.function.AntlrParserTrigonometricTest.java

@Test
public void atanNull() {
    try {//from   ww  w  .  java 2s. c  o  m
        Expression expression = getExpressionWithFunctionContext("atan(0)");
        assertEquals(ExpressionType.DOUBLE, expression.getExpressionType());
        assertEquals(Math.asin(0), expression.evaluateNumerical(), 1e-15);
    } catch (ExpressionException e) {
        assertNotNull(e.getMessage());
    }
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>ASIN</code> operator applied to long values. */
public static double asin(long b0) {
    return Math.asin(b0);
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>ASIN</code> operator applied to BigDecimal values. */
public static double asin(BigDecimal b0) {
    return Math.asin(b0.doubleValue());
}

From source file:org.apache.calcite.runtime.SqlFunctions.java

/** SQL <code>ASIN</code> operator applied to double values. */
public static double asin(double b0) {
    return Math.asin(b0);
}

From source file:com.hit.jj.mapshow.RoutingActivity.java

public double Distance(double long1, double lat1, double long2, double lat2) {

    double a, b, R;
    R = 6378137; // ??
    lat1 = lat1 * Math.PI / 180.0;
    lat2 = lat2 * Math.PI / 180.0;
    a = lat1 - lat2;//from w  w  w  .ja  v a 2  s .  com
    b = (long1 - long2) * Math.PI / 180.0;
    double d;
    double sa2, sb2;
    sa2 = Math.sin(a / 2.0);
    sb2 = Math.sin(b / 2.0);
    d = 2 * R * Math.asin(Math.sqrt(sa2 * sa2 + Math.cos(lat1) * Math.cos(lat2) * sb2 * sb2));
    return d;
}

From source file:InertiaMatrix.java

public static final Vector3 anguarVelocity(Quaternion q0, Quaternion q1) {
    Quaternion q0inv = new Quaternion(q0.s, q0.v.multiply(-1)).multiply(1 / q0.dot(q0));
    Quaternion r = q0inv.multiply(q1);//from w  ww. j  av  a 2s  .c  om

    double sinomeganormhalf = r.v.norm();

    // zero angular velocity
    if (sinomeganormhalf < 1e-7) {
        return new Vector3();
    }

    Vector3 n = r.v.multiply(1 / sinomeganormhalf);

    double omegaNorm = Math.asin(sinomeganormhalf) * 2;

    return n.multiply(omegaNorm);
}