本文整理了Java中java.lang.Math.atan()
方法的一些代码示例,展示了Math.atan()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Math.atan()
方法的具体详情如下:
包路径:java.lang.Math
类名称:Math
方法名:atan
[英]Returns the closest double approximation of the arc tangent of the argument within the range [-pi/2..pi/2]. The returned result is within 1 ulp (unit in the last place) of the real result.
Special cases:
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
/**
* Returns the arc tangent of an angle given in radians.<br>
* @param fValue The angle, in radians.
* @return fValue's atan
* @see java.lang.Math#atan(double)
*/
public static float atan(float fValue) {
return (float) Math.atan(fValue);
}
代码示例来源:origin: apache/mahout
@Override
public double apply(double a) {
return Math.atan(a);
}
};
代码示例来源:origin: google/ExoPlayer
private float calculateFieldOfViewInYDirection(float aspect) {
boolean landscapeMode = aspect > 1;
if (landscapeMode) {
double halfFovX = FIELD_OF_VIEW_DEGREES / 2;
double tanY = Math.tan(Math.toRadians(halfFovX)) / aspect;
double halfFovY = Math.toDegrees(Math.atan(tanY));
return (float) (halfFovY * 2);
} else {
return FIELD_OF_VIEW_DEGREES;
}
}
}
代码示例来源:origin: plantuml/plantuml
public double inverseProjectY(double y)
{
return Math.sin(Math.atan(y));
}
}
代码示例来源:origin: plantuml/plantuml
public double inverseProjectY(double y)
{
return Math.sin(2 * (Math.atan(Math.exp(y)) - Math.PI / 4));
}
}
代码示例来源:origin: apache/incubator-druid
@Override
protected ExprEval eval(double param)
{
return ExprEval.of(Math.atan(param));
}
}
代码示例来源:origin: plantuml/plantuml
public BigDecimal eval(List<? extends Number> parameters) {
assertNotNull(parameters.get(0));
double d = Math.toDegrees(Math.atan(parameters.get(0).doubleValue()));
return new BigDecimal(d, mc);
}
});
代码示例来源:origin: googlemaps/android-maps-utils
public LatLng toLatLng(com.google.maps.android.geometry.Point point) {
final double x = point.x / mWorldWidth - 0.5;
final double lng = x * 360;
double y = .5 - (point.y / mWorldWidth);
final double lat = 90 - Math.toDegrees(Math.atan(Math.exp(-y * 2 * Math.PI)) * 2);
return new LatLng(lat, lng);
}
}
代码示例来源:origin: plantuml/plantuml
public BigDecimal eval(List<? extends Number> parameters) {
assertNotNull(parameters.get(0));
/** Formula: acot(x) = atan(1/x) */
if (parameters.get(0).doubleValue() == 0) {
throw new ExpressionException("Number must not be 0");
}
double d = Math.toDegrees(Math.atan(1 / parameters.get(0).doubleValue()));
return new BigDecimal(d, mc);
}
});
代码示例来源:origin: stackoverflow.com
Camera.Parameters p = camera.getParameters();
int zoom = p.getZoomRatios().get(p.getZoom()).intValue();
Camera.Size sz = p.getPreviewSize();
double aspect = (double) sz.width / (double) sz.height;
double thetaV = Math.toRadians(p.getVerticalViewAngle());
double thetaH = 2d * Math.atan(aspect * Math.tan(thetaV / 2));
thetaV = 2d * Math.atan(100d * Math.tan(thetaV / 2d) / zoom);
thetaH = 2d * Math.atan(100d * Math.tan(thetaH / 2d) / zoom);
代码示例来源:origin: apache/hive
@Override
protected DoubleWritable doEvaluate(DoubleWritable a) {
result.set(Math.atan(a.get()));
return result;
}
代码示例来源:origin: prestodb/presto
private static Point tileXYToLatitudeLongitude(int tileX, int tileY, int zoomLevel)
{
long mapSize = mapSize(zoomLevel);
double x = (clip(tileX * TILE_PIXELS, 0, mapSize) / mapSize) - 0.5;
double y = 0.5 - (clip(tileY * TILE_PIXELS, 0, mapSize) / mapSize);
double latitude = 90 - 360 * Math.atan(Math.exp(-y * 2 * Math.PI)) / Math.PI;
double longitude = 360 * x;
return new Point(longitude, latitude);
}
代码示例来源:origin: neo4j/neo4j
public static DoubleValue atan( AnyValue in )
{
if ( in instanceof NumberValue )
{
return doubleValue( Math.atan( ((NumberValue) in).doubleValue() ) );
}
else
{
throw needsNumbers( "atan()" );
}
}
代码示例来源:origin: prestodb/presto
@Test
public void testAtan()
{
for (double doubleValue : DOUBLE_VALUES) {
assertFunction("atan(" + doubleValue + ")", DOUBLE, Math.atan(doubleValue));
assertFunction("atan(REAL '" + (float) doubleValue + "')", DOUBLE, Math.atan((float) doubleValue));
}
assertFunction("atan(NULL)", DOUBLE, null);
}
代码示例来源:origin: prestodb/presto
@Description("arc tangent")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
public static double atan(@SqlType(StandardTypes.DOUBLE) double num)
{
return Math.atan(num);
}
代码示例来源:origin: stackoverflow.com
private static double zoomAngle(double degrees, int zoom) {
double theta = Math.toRadians(degrees);
return 2d * Math.atan(100d * Math.tan(theta / 2d) / zoom);
}
Camera.Parameters p = camera.getParameters();
int zoom = p.getZoomRatios().get(p.getZoom()).intValue();
double thetaH = zoomAngle(p.getHorizontalViewAngle(), zoom);
double thetaV = zoomAngle(p.getVerticalViewAngle(), zoom);
代码示例来源:origin: plantuml/plantuml
public Coordinate getLocation(int pX, int pY)
{
final Coordinate lRaw = new Coordinate(
2 * (Math.atan(Math.exp(inverseFinalizeY(pY))) - Math.PI / 4),
inverseFinalizeX(pX));
return rotateReverse(lRaw.getPoint3DRads()).getCoordinate();
}
代码示例来源:origin: pentaho/pentaho-kettle
public Value atan() throws KettleValueException {
if ( isNull() ) {
return this;
}
if ( isNumeric() ) {
setValue( Math.atan( getNumber() ) );
} else {
throw new KettleValueException( "Function ATAN only works with numeric data" );
}
return this;
}
代码示例来源:origin: plantuml/plantuml
public Coordinate getLocation(int pX, int pY)
{
final Coordinate lRaw = new Coordinate(Math.atan(inverseFinalizeY(pY)),
inverseFinalizeX(pX));
return rotateReverse(lRaw.getPoint3DRads()).getCoordinate();
}
代码示例来源:origin: apache/hive
@Test
public void testVectorATan() throws HiveException {
VectorizedRowBatch b = getVectorizedRowBatchDoubleInDoubleOut();
DoubleColumnVector resultV = (DoubleColumnVector) b.cols[1];
b.cols[0].noNulls = true;
VectorExpression expr = new FuncATanDoubleToDouble(0, 1);
expr.evaluate(b);
Assert.assertEquals(Math.atan(0.5d), resultV.vector[4]);
}
内容来源于网络,如有侵权,请联系作者删除!