/** * 获得两个圆切线与圆心连线的夹角 * @return 夹角 */ private double getAngle() { if (bottomCircle.radius > topCircle.radius) { // throw new IllegalStateException("bottomCircle's radius must be less than the topCircle's"); return 0; } return Math.asin((topCircle.radius - bottomCircle.radius) / (bottomCircle.y - topCircle.y)); }
@Override public double apply(double a) { return Math.asin(a); } };
public float getInterpolation(float input) { if (input == 0) { return 0f; } else if (input == 1) { return 1f; } float p = 0.3f; float s = p / DOUBLE_PI * (float) Math.asin(1f); return -((float) Math.pow(2f, 10f * (input -= 1f)) *(float) Math.sin((input - s) * DOUBLE_PI / p)); } };
public float getInterpolation(float input) { if (input == 0) { return 0f; } else if (input == 1) { return 1f; } float p = 0.3f; float s = p / DOUBLE_PI * (float) Math.asin(1f); return 1f + (float) Math.pow(2f, -10f * input) * (float) Math.sin((input - s) * DOUBLE_PI / p); } };
public float getInterpolation(float input) { if (input == 0) { return 0f; } input *= 2f; if (input == 2) { return 1f; } float p = 1f / 0.45f; float s = 0.45f / DOUBLE_PI * (float) Math.asin(1f); if (input < 1f) { return -0.5f * ((float) Math.pow(2f, 10f * (input -= 1f)) * (float) Math.sin((input * 1f - s) * DOUBLE_PI * p)); } return 1f + 0.5f * (float) Math.pow(2f, -10f * (input -= 1f)) * (float) Math.sin((input * 1f - s) * DOUBLE_PI * p); } };
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)); } return result; }
/** * @return Latitude (-PI/2 to PI/2), projected from center of Earth on * y axis with a twist and a log scale. */ public double projectY(double pY) { return (pY >= 0.9999999999) ? 1e6 : (pY <= -0.9999999999) ? -1e6 : Math.log(Math.tan(Math.asin(pY) / 2 + Math.PI / 4)); }
@Override protected ExprEval eval(double param) { return ExprEval.of(Math.asin(param)); } }
public BigDecimal eval(List<? extends Number> parameters) { assertNotNull(parameters.get(0)); double d = Math.toDegrees(Math.asin(parameters.get(0).doubleValue())); return new BigDecimal(d, mc); } });
/** * Calculates distance of (from, to) in meter. * <p> * http://en.wikipedia.org/wiki/Haversine_formula a = sin²(Δlat/2) + * cos(lat1).cos(lat2).sin²(Δlong/2) c = 2.atan2(√a, √(1−a)) d = R.c */ @Override public double calcDist(double fromLat, double fromLon, double toLat, double toLon) { double normedDist = calcNormalizedDist(fromLat, fromLon, toLat, toLon); return R * 2 * asin(sqrt(normedDist)); }
/** Get the pitch euler angle in radians, which is the rotation around the x axis. Requires that this quaternion is normalized. * @return the rotation around the x axis in radians (between -(PI/2) and +(PI/2)) */ public float getPitchRad () { final int pole = getGimbalPole(); return pole == 0 ? (float)Math.asin(MathUtils.clamp(2f * (w * x - z * y), -1f, 1f)) : (float)pole * MathUtils.PI * 0.5f; }
/** Get the pitch euler angle in radians, which is the rotation around the x axis. Requires that this quaternion is normalized. * @return the rotation around the x axis in radians (between -(PI/2) and +(PI/2)) */ public float getPitchRad () { final int pole = getGimbalPole(); return pole == 0 ? (float)Math.asin(MathUtils.clamp(2f * (w * x - z * y), -1f, 1f)) : (float)pole * MathUtils.PI * 0.5f; }
private static double addDistanceToLatitude( @SqlType(StandardTypes.DOUBLE) double latitude, @SqlType(StandardTypes.DOUBLE) double radiusInKm, @SqlType(StandardTypes.DOUBLE) double bearing) { double latitudeInRadians = toRadians(latitude); double bearingInRadians = toRadians(bearing); double radiusRatio = radiusInKm / EARTH_RADIUS_KM; // Haversine formula double newLatitude = toDegrees(asin(sin(latitudeInRadians) * cos(radiusRatio) + cos(latitudeInRadians) * sin(radiusRatio) * cos(bearingInRadians))); if (newLatitude > MAX_LATITUDE) { return MAX_LATITUDE; } if (newLatitude < MIN_LATITUDE) { return MIN_LATITUDE; } return newLatitude; }
/** * Take Arc Sine of a in radians. */ @Override protected DoubleWritable doEvaluate(DoubleWritable a) { double d = a.get(); if (d < -1 || d > 1) { return null; } else { result.set(Math.asin(d)); return result; } }
public static DoubleValue asin( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.asin( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "asin()" ); } }
public Coordinate getCoordinate() { return new Coordinate(Toolkit.radsToDegs(Math.asin(fY)), Toolkit.radsToDegs(Math.atan2(fX, fZ))); } }
@Description("arc sine") @ScalarFunction @SqlType(StandardTypes.DOUBLE) public static double asin(@SqlType(StandardTypes.DOUBLE) double num) { return Math.asin(num); }
public Value asin() throws KettleValueException { if ( isNull() ) { return this; } if ( isNumeric() ) { setValue( Math.asin( getNumber() ) ); } else { throw new KettleValueException( "Function ASIN only works with numeric data" ); } return this; }
@Test public void testVectorASin() throws HiveException { VectorizedRowBatch b = getVectorizedRowBatchDoubleInDoubleOut(); DoubleColumnVector resultV = (DoubleColumnVector) b.cols[1]; b.cols[0].noNulls = true; VectorExpression expr = new FuncASinDoubleToDouble(0, 1); expr.evaluate(b); Assert.assertEquals(Math.asin(0.5d), resultV.vector[4]); }