Example usage for java.lang Math tan

List of usage examples for java.lang Math tan

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static double tan(double a) 

Source Link

Document

Returns the trigonometric tangent of an angle.

Usage

From source file:org.jtrfp.trcl.Camera.java

private void updateProjectionMatrix() {
    final Component component = gpu.getTr().getRootWindow();
    final float fov = 70f;// In degrees
    final float aspect = (float) component.getWidth() / (float) component.getHeight();
    final float zF = (float) (viewDepth * 1.5);
    final float zN = (float) (TR.mapSquareSize / 10);
    final float f = (float) (1. / Math.tan(fov * Math.PI / 360.));
    projectionMatrix = new Array2DRowRealMatrix(new double[][] { new double[] { f / aspect, 0, 0, 0 },
            new double[] { 0, f, 0, 0 }, new double[] { 0, 0, (zF + zN) / (zN - zF), -1f },
            new double[] { 0, 0, (2f * zF * zN) / (zN - zF), 0 } }).transpose();
}

From source file:com.opengamma.analytics.math.TrigonometricFunctionUtils.java

public static double tan(final double x) {
    return Math.tan(x);
}

From source file:com.nextbreakpoint.nextfractal.mandelbrot.core.Expression.java

public static double funcTan(double x) {
    return Math.tan(x);
}

From source file:org.apache.flink.table.runtime.functions.SqlFunctionUtils.java

public static double tan(Decimal a) {
    return Math.tan(a.doubleValue());
}

From source file:com.wwidesigner.geometry.calculation.DefaultHoleCalculator.java

public TransferMatrix calcTransferMatrix_2010(Hole hole, boolean isOpen, double waveNumber,
        PhysicalParameters parameters) {
    double radius = mFudgeFactor * hole.getDiameter() / 2;
    double boreRadius = hole.getBoreDiameter() / 2;
    Complex Zs = null;// w ww .  j  a va 2  s  .  com
    Complex Za = null;

    // double Z0 = parameters.calcZ0(boreRadius);
    double Z0h = parameters.calcZ0(radius);

    double delta = radius / boreRadius;

    double tm = (radius * delta / 8.) * (1. + 0.207 * delta * delta * delta);
    double te = hole.getHeight() + tm;

    double ta = 0.;

    // Complex Gamma = Complex.I.multiply(wave_number);

    if (isOpen) // open
    {
        double kb = waveNumber * radius;
        double ka = waveNumber * boreRadius;
        double xhi = 0.25 * kb * kb;

        ta = (-0.35 + 0.06 * Math.tanh(2.7 * hole.getHeight() / radius)) * radius * delta * delta * delta
                * delta;

        Complex Zr = Complex.I.multiply(waveNumber * 0.61 * radius).add(xhi);

        Complex Zo = (Zr.multiply(Math.cos(waveNumber * te)).add(Complex.I.multiply(Math.sin(waveNumber * te))))
                .divide(Complex.I.multiply(Zr).multiply(Math.sin(waveNumber * te))
                        .add(Math.cos(waveNumber * te)));

        double ti = radius
                * (0.822 - 0.10 * delta - 1.57 * delta * delta + 2.14 * delta * delta * delta
                        - 1.6 * delta * delta * delta * delta + 0.50 * delta * delta * delta * delta * delta)
                * (1. + (1. - 4.56 * delta + 6.55 * delta * delta)
                        * (0.17 * ka + 0.92 * ka * ka + 0.16 * ka * ka * ka - 0.29 * ka * ka * ka * ka));

        Zs = Complex.I.multiply(waveNumber * ti).add(Zo).multiply(Z0h);

    } else {
        ta = (-0.12 - 0.17 * Math.tanh(2.4 * hole.getHeight() / radius)) * radius * delta * delta * delta
                * delta;
        Zs = Complex.valueOf(0, -Z0h / Math.tan(waveNumber * te));
    }

    Za = Complex.I.multiply(Z0h * waveNumber * ta);
    Complex Za_Zs = Za.divide(Zs);

    TransferMatrix result = new TransferMatrix(Za_Zs.divide(2.).add(1.), Za.multiply(Za_Zs.divide(4.).add(1.)),
            Complex.ONE.divide(Zs), Za_Zs.divide(2.0).add(1.));

    assert result.determinant() == Complex.ONE;

    return result;
}

From source file:org.apache.flink.table.runtime.functions.SqlFunctionUtils.java

public static double cot(Decimal a) {
    return 1.0d / Math.tan(a.doubleValue());
}

From source file:uk.ac.diamond.scisoft.ncd.calibration.CalibrationMethods.java

private LinkedHashMap<IPeak, HKL> indexPeaks(LinkedHashMap<HKL, Amount<Angle>> twoTheta) {
    LinkedHashMap<IPeak, HKL> indexedPeaks = new LinkedHashMap<IPeak, HKL>(peaks.size());
    CombinationGenerator<HKL> combinations = new CombinationGenerator<HKL>(twoTheta.keySet(), peaks.size());
    Double minVar = Double.MAX_VALUE;
    for (List<HKL> comb : combinations) {
        ArrayList<Double> distance = new ArrayList<Double>();
        LinkedHashMap<IPeak, HKL> tmpResult = new LinkedHashMap<IPeak, HKL>();
        for (int i = 0; i < comb.size(); i++) {
            IPeak peak = peaks.get(i);/* w  w  w  .j  av  a  2  s .  c  o  m*/
            HKL tmpHKL = comb.get(i);
            distance.add(peak.getPosition() / Math.tan(twoTheta.get(tmpHKL).doubleValue(SI.RADIAN)));
            tmpResult.put(peak, tmpHKL);
        }
        double var = fitFunctionToData(tmpResult, false);
        if (var > minVar)
            continue;
        indexedPeaks = tmpResult;
        minVar = var;
    }

    indexedPeakList = new ArrayList<CalibrationPeak>();
    for (Entry<IPeak, HKL> peak : indexedPeaks.entrySet()) {
        double position = peak.getKey().getPosition();
        HKL idx = peak.getValue();
        Amount<Angle> angle = twoTheta.get(idx);
        indexedPeakList.add(new CalibrationPeak(position, angle, idx));
    }

    return indexedPeaks;
}

From source file:org.apache.drill.exec.fn.impl.TestNewMathFunctions.java

@Test
public void testTrigoMathFunc() throws Throwable {
    final Object[] expected = new Object[] { Math.sin(45), Math.cos(45), Math.tan(45), Math.asin(45),
            Math.acos(45), Math.atan(45), Math.sinh(45), Math.cosh(45), Math.tanh(45) };
    runTest(expected, "functions/testTrigoMathFunctions.json");
}

From source file:VrmlPickingTest.java

public TransformGroup[] getViewTransformGroupArray() {
    TransformGroup[] tgArray = new TransformGroup[1];
    tgArray[0] = new TransformGroup();

    Transform3D viewTrans = new Transform3D();
    Transform3D eyeTrans = new Transform3D();

    BoundingSphere sceneBounds = (BoundingSphere) m_SceneBranchGroup.getBounds();

    // point the view at the center of the object
    Point3d center = new Point3d();
    sceneBounds.getCenter(center);/*from w w  w  . j ava  2s  .  co  m*/
    double radius = sceneBounds.getRadius();
    Vector3d temp = new Vector3d(center);
    viewTrans.set(temp);

    // pull the eye back far enough to see the whole object
    double eyeDist = 1.4 * radius / Math.tan(Math.toRadians(40) / 2.0);
    temp.x = 0.0;
    temp.y = 0.0;
    temp.z = eyeDist;
    eyeTrans.set(temp);
    viewTrans.mul(eyeTrans);

    // set the view transform
    tgArray[0].setTransform(viewTrans);

    return tgArray;
}

From source file:org.talend.dataprofiler.core.ui.grid.AbstractIndicatorSelectGrid.java

/**
 * IndicatorSelectionGrid constructor.//ww  w  .  ja va 2  s .c o m
 * 
 * @param parent
 * @param style
 * @param modelElementIndicators
 * @param modelElementIndicators
 */
public AbstractIndicatorSelectGrid(IndicatorSelectDialog dialog, Composite parent, int style,
        ModelElementIndicator[] modelElementIndicators, int limit, List<Object[]> previewData) {
    super(parent, style);
    limitNumber = limit;
    this.previewData = previewData;
    _dialog = dialog;
    _modelElementIndicators = modelElementIndicators;
    addExtraListeners();
    tanRotation = Math.tan(Math.PI * COLUMN_HEADER_ROTATION / 180);

}