Tabnine Logo
Math.tan
Code IndexAdd Tabnine to your IDE (free)

How to use
tan
method
in
java.lang.Math

Best Java code snippets using java.lang.Math.tan (Showing top 20 results out of 5,265)

origin: libgdx/libgdx

public static float[] createPerspectiveMatrix (int fieldOfViewVertical, float aspectRatio, float minimumClearance,
  float maximumClearance) {
  double fieldOfViewInRad = fieldOfViewVertical * Math.PI / 180.0;
  return new float[] {(float)(Math.tan(fieldOfViewInRad) / aspectRatio), 0, 0, 0, 0,
    (float)(1 / Math.tan(fieldOfViewVertical * Math.PI / 180.0)), 0, 0, 0, 0,
    (minimumClearance + maximumClearance) / (minimumClearance - maximumClearance), -1, 0, 0,
    2 * minimumClearance * maximumClearance / (minimumClearance - maximumClearance), 0};
}
origin: libgdx/libgdx

public static float[] createPerspectiveMatrix (int fieldOfViewVertical, float aspectRatio, float minimumClearance,
  float maximumClearance) {
  double fieldOfViewInRad = fieldOfViewVertical * Math.PI / 180.0;
  return new float[] {(float)(Math.tan(fieldOfViewInRad) / aspectRatio), 0, 0, 0, 0,
    (float)(1 / Math.tan(fieldOfViewVertical * Math.PI / 180.0)), 0, 0, 0, 0,
    (minimumClearance + maximumClearance) / (minimumClearance - maximumClearance), -1, 0, 0,
    2 * minimumClearance * maximumClearance / (minimumClearance - maximumClearance), 0};
}
origin: Bilibili/DanmakuFlameMaster

@Override
public void setSize(int width, int height) {
  this.width = width;
  this.height = height;
  this.locationZ = (float) (width / 2f / Math.tan((Math.PI / 180) * (55f / 2f)));
}
origin: nickbutcher/plaid

private static float toTangent(float arcInDegrees) {
  if (arcInDegrees < 0 || arcInDegrees > 90) {
    throw new IllegalArgumentException("Arc must be between 0 and 90 degrees");
  }
  return (float) Math.tan(Math.toRadians(arcInDegrees / 2));
}
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: andkulikov/Transitions-Everywhere

private static float toTangent(float arcInDegrees) {
  if (arcInDegrees < 0 || arcInDegrees > 90) {
    throw new IllegalArgumentException("Arc must be between 0 and 90 degrees");
  }
  return (float) Math.tan(Math.toRadians(arcInDegrees / 2));
}
origin: apache/incubator-druid

 @Override
 protected ExprEval eval(double param)
 {
  return ExprEval.of(Math.tan(param));
 }
}
origin: kevin-wayne/algs4

/**
 * Returns a random real number from the Cauchy distribution.
 *
 * @return a random real number from the Cauchy distribution.
 */
public static double cauchy() {
  return Math.tan(Math.PI * (uniform() - 0.5));
}
origin: guoguibing/librec

/**
 * Return a real number with a Cauchy distribution.
 *
 * @return a real number with a Cauchy distribution
 */
public static double cauchy() {
  return Math.tan(Math.PI * (uniform() - 0.5));
}
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

/**
 * Take Tangent of a
 */
@Override
protected DoubleWritable doEvaluate(DoubleWritable a) {
 result.set(Math.tan(a.get()));
 return result;
}
origin: MovingBlocks/Terasology

private static Matrix4f createPerspectiveProjectionMatrix(float fov, float zNear, float zFar) {
  float aspectRatio = (float) Display.getWidth() / Display.getHeight();
  float fovY = (float) (2 * Math.atan2(Math.tan(0.5 * fov * TeraMath.DEG_TO_RAD), aspectRatio));
  return MatrixUtils.createPerspectiveProjectionMatrix(fovY, aspectRatio, zNear, zFar);
}
origin: neo4j/neo4j

public static DoubleValue cot( AnyValue in )
{
  if ( in instanceof NumberValue )
  {
    return doubleValue( 1.0 / Math.tan( ((NumberValue) in).doubleValue() ) );
  }
  else
  {
    throw needsNumbers( "cot()" );
  }
}
origin: neo4j/neo4j

public static DoubleValue tan( AnyValue in )
{
  if ( in instanceof NumberValue )
  {
    return doubleValue( Math.tan( ((NumberValue) in).doubleValue() ) );
  }
  else
  {
    throw needsNumbers( "tan()" );
  }
}
origin: prestodb/presto

@Test
public void testTan()
{
  for (double doubleValue : DOUBLE_VALUES) {
    assertFunction("tan(" + doubleValue + ")", DOUBLE, Math.tan(doubleValue));
    assertFunction("tan(REAL '" + (float) doubleValue + "')", DOUBLE, Math.tan((float) doubleValue));
  }
  assertFunction("tan(NULL)", DOUBLE, null);
}
origin: prestodb/presto

@Description("tangent")
@ScalarFunction
@SqlType(StandardTypes.DOUBLE)
public static double tan(@SqlType(StandardTypes.DOUBLE) double num)
{
  return Math.tan(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: pentaho/pentaho-kettle

public Value tan() throws KettleValueException {
 if ( isNull() ) {
  return this;
 }
 if ( isNumeric() ) {
  setValue( Math.tan( getNumber() ) );
 } else {
  throw new KettleValueException( "Function TAN only works on a number" );
 }
 return this;
}
origin: apache/hive

@Test
public void testVectorTan() throws HiveException {
 VectorizedRowBatch b = getVectorizedRowBatchDoubleInDoubleOut();
 DoubleColumnVector resultV = (DoubleColumnVector) b.cols[1];
 b.cols[0].noNulls = true;
 VectorExpression expr = new FuncTanDoubleToDouble(0, 1);
 expr.evaluate(b);
 Assert.assertEquals(Math.tan(0.5d), resultV.vector[4]);
}
origin: jfoenixadmin/JFoenix

private Point2D makeControlPoint(final double endX, final double endY, final Circle circle, final int numSegments, int direction) {
  final double controlPointDistance = (4.0 / 3.0) * Math.tan(Math.PI / (2 * numSegments)) * circle.getRadius();
  final Point2D center = new Point2D(circle.getCenterX(), circle.getCenterY());
  final Point2D end = new Point2D(endX, endY);
  Point2D perp = rotate(center, end, direction * Math.PI / 2.);
  Point2D diff = perp.subtract(end);
  diff = diff.normalize();
  diff = scale(diff, controlPointDistance);
  return end.add(diff);
}
java.langMathtan

Javadoc

Returns the closest double approximation of the tangent of the argument. The returned result is within 1 ulp (unit in the last place) of the real result.

Special cases:

  • tan(+0.0) = +0.0
  • tan(-0.0) = -0.0
  • tan(+infinity) = NaN
  • tan(-infinity) = NaN
  • tan(NaN) = NaN

Popular methods of Math

  • min
    Returns the smaller of two long values. That is, the result is the argument closer to the value of L
  • max
    Returns the greater of two long values. That is, the result is the argument closer to the value of L
  • abs
    Returns the absolute value of a long value. If the argument is not negative, the argument is returne
  • round
    Returns the closest int to the argument, with ties rounding up. Special cases: * If the argument is
  • pow
    Returns the value of the first argument raised to the power of the second argument. Special cases: *
  • sqrt
    Returns the correctly rounded positive square root of a double value. Special cases: * If the argume
  • ceil
    Returns the smallest (closest to negative infinity) double value that is greater than or equal to th
  • floor
    Returns the largest (closest to positive infinity) double value that is less than or equal to the ar
  • random
    Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returne
  • sin
    Returns the trigonometric sine of an angle. Special cases: * If the argument is NaN or an infinit
  • cos
    Returns the trigonometric cosine of an angle. Special cases: * If the argument is NaN or an infin
  • log
    Returns the natural logarithm (base e) of a doublevalue. Special cases: * If the argument is NaN
  • cos,
  • log,
  • exp,
  • toRadians,
  • atan2,
  • log10,
  • acos,
  • toDegrees,
  • atan

Popular in Java

  • Reactive rest calls using spring rest template
  • getExternalFilesDir (Context)
  • getSharedPreferences (Context)
  • onCreateOptionsMenu (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Menu (java.awt)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • String (java.lang)
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Path (java.nio.file)
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now