Example usage for java.lang Math sin

List of usage examples for java.lang Math sin

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static double sin(double a) 

Source Link

Document

Returns the trigonometric sine of an angle.

Usage

From source file:de.biomedical_imaging.ij.steger.Lines_.java

private void displayContours() {
    imp.setOverlay(null);/*  w  ww. j  a v a2  s.  c  o  m*/
    Overlay ovpoly = new Overlay();

    double px, py, nx, ny, px_r = 0, py_r = 0, px_l = 0, py_l = 0;
    double last_w_r, last_w_l;

    // Print contour and boundary
    for (int k = 0; k < result.size(); k++) {
        for (int i = 0; i < result.get(k).size(); i++) {
            FloatPolygon polyMitte = new FloatPolygon();

            FloatPolygon polyR = new FloatPolygon();
            FloatPolygon polyL = new FloatPolygon();
            Line cont = result.get(k).get(i);
            int num_points = cont.num;
            last_w_r = 0;
            last_w_l = 0;

            for (int j = 0; j < num_points; j++) {

                px = cont.col[j];
                py = cont.row[j];
                nx = Math.sin(cont.angle[j]);
                ny = Math.cos(cont.angle[j]);
                if (doEstimateWidth) {
                    px_r = px + cont.width_r[j] * nx;
                    py_r = py + cont.width_r[j] * ny;
                    px_l = px - cont.width_l[j] * nx;
                    py_l = py - cont.width_l[j] * ny;
                }

                polyMitte.addPoint((px + 0.5), (py + 0.5));
                if (doEstimateWidth) {
                    if (last_w_r > 0 && cont.width_r[j] > 0) {
                        polyR.addPoint((px_r + 0.5), (py_r + 0.5));
                    }
                    if (last_w_l > 0 && cont.width_l[j] > 0) {
                        polyL.addPoint((px_l + 0.5), (py_l + 0.5));
                    }
                }
                if (doEstimateWidth) {
                    last_w_r = cont.width_r[j];
                    last_w_l = cont.width_l[j];
                }
            }

            PolygonRoi polyRoiMitte = new PolygonRoi(polyMitte, Roi.POLYLINE);

            polyRoiMitte.setStrokeColor(Color.red);
            int position = result.get(k).getFrame();
            if (!doStack || isPreview) {
                position = imp.getCurrentSlice();
            }

            polyRoiMitte.setPosition(position);
            ovpoly.add(polyRoiMitte);

            if (doEstimateWidth) {
                if (polyL.npoints > 1) {
                    PolygonRoi polyRoiRand1 = new PolygonRoi(polyL, Roi.POLYLINE);
                    polyRoiRand1.setStrokeColor(Color.green);
                    position = result.get(k).getFrame();
                    if (!doStack || isPreview) {
                        position = imp.getCurrentSlice();
                    }
                    polyRoiRand1.setPosition(position);
                    ovpoly.add(polyRoiRand1);

                    PolygonRoi polyRoiRand2 = new PolygonRoi(polyR, Roi.POLYLINE);
                    polyRoiRand2.setStrokeColor(Color.green);
                    polyRoiRand2.setPosition(position);
                    ovpoly.add(polyRoiRand2);
                }
            }

            //Show IDs
            if (showIDs) {/*
                          int posx =  polyMitte.xpoints[0];
                          int posy =  polyMitte.ypoints[0];
                          if(cont.cont_class == contour_class.cont_start_junc){
                          posx =  polyMitte.xpoints[polyMitte.npoints-1];
                          posy =  polyMitte.ypoints[polyMitte.npoints-1];
                          }
                          */

                int posx = (int) polyMitte.xpoints[polyMitte.npoints / 2];
                int posy = (int) polyMitte.ypoints[polyMitte.npoints / 2];
                TextRoi tr = new TextRoi(posx, posy, "" + cont.getID());
                tr.setCurrentFont(new Font(Font.SANS_SERIF, Font.PLAIN, 9));
                tr.setIgnoreClipRect(true);
                tr.setStrokeColor(Color.orange);
                tr.setPosition(resultJunction.get(k).getFrame());
                ovpoly.add(tr);
            }
        }
    }
    if (showJunctionPoints) {
        // Print junctions

        for (int k = 0; k < resultJunction.size(); k++) {
            FloatPolygon pointpoly = new FloatPolygon();
            for (int i = 0; i < resultJunction.get(k).size(); i++) {

                pointpoly.addPoint(resultJunction.get(k).get(i).x + 0.5, resultJunction.get(k).get(i).y + 0.5);
            }

            PointRoi pointroi = new PointRoi(pointpoly);
            pointroi.setShowLabels(false);
            int position = resultJunction.get(k).getFrame();
            if (!doStack || isPreview) {
                position = imp.getCurrentSlice();
            }
            pointroi.setPosition(position);
            ovpoly.add(pointroi);
        }
    }
    if (ovpoly.size() > 0) {
        imp.setOverlay(ovpoly);
    }
}

From source file:itdelatrisu.opsu.Utils.java

public static float[] mirrorPoint(float x, float y) {
    double dx = x - displayContainer.width / 2d;
    double dy = y - displayContainer.height / 2d;
    double ang = Math.atan2(dy, dx);
    double d = -Math.sqrt(dx * dx + dy * dy);
    return new float[] { (float) (displayContainer.width / 2d + Math.cos(ang) * d),
            (float) (displayContainer.height / 2d + Math.sin(ang) * d) };
}

From source file:com.automaster.autoview.server.servlet.ExcelServlet.java

private double caculaDistanciaEntreDoisPontos(double lat1, double lon1, double lat2, double lon2) {

    //Transforma cordenadas em radianos
    /*String lat1Reduzida = String.valueOf(lat1);
    int index = lat1Reduzida.indexOf(".");
    String latFinal1 = lat1Reduzida.substring(0, index+5);
            /*from  w w w .  j  av  a  2 s  .  c o  m*/
    String lon1Reduzida = String.valueOf(lon1);
    String lonFinal1 = lon1Reduzida.substring(0, index+5);
            
    String lat2Reduzida = String.valueOf(lat2);
    String latFinal2 = lat2Reduzida.substring(0, index+5);
            
    String lon2Reduzida = String.valueOf(lon2);
    String lonFinal2 = lon2Reduzida.substring(0, index+5);*/

    double lat01 = Math.toRadians(lat1);
    double lon01 = Math.toRadians(lon1);
    double lat02 = Math.toRadians(lat2);
    double lon02 = Math.toRadians(lon2);
    //calcula a distncia em KM atravs da frmula
    double dist = (6371 * Math.acos(
            Math.cos(lat01) * Math.cos(lat02) * Math.cos(lon02 - lon01) + Math.sin(lat01) * Math.sin(lat02)));
    //formata o resultado
    if (dist > 0) {
        BigDecimal decimalFormatado = new BigDecimal(dist).setScale(2, RoundingMode.HALF_EVEN);
        return decimalFormatado.doubleValue();
    }
    return 0;
    //return dist;

}

From source file:gbt.ubt.tool.Orthorectifier.java

public static double vincentyFormulae(double lat1, double long1, double lat2, double long2) {
    double latitude1 = deg2rad(lat1);
    double longitude1 = deg2rad(long1);
    double latitude2 = deg2rad(lat2);
    double longitude2 = deg2rad(long2);
    double a = 6378137.0;
    double f = 1.0 / 298.257223563;
    double b = (1.0 - f) * a;
    double u1 = Math.atan((1.0 - f) * Math.tan(latitude1));
    double u2 = Math.atan((1.0 - f) * Math.tan(latitude2));
    double L = longitude2 - longitude1;
    double lambda = L;
    double diff = 1.0;
    double tol = 10.0e-8;
    double cos2Alpha = 0.0;
    double sinOmega = 0.0;
    double cos2OmegaM = 0.0;
    double cosOmega = 0.0;
    double omega = 0.0;
    while (diff > tol) {
        sinOmega = Math.sqrt(Math.pow((Math.cos(u2) * Math.sin(lambda)), 2) + (Math
                .pow(((Math.cos(u1) * Math.sin(u2)) - (Math.sin(u1) * Math.cos(u2) * Math.cos(lambda))), 2)));
        cosOmega = (Math.sin(u1) * Math.sin(u2)) + (Math.cos(u1) * Math.cos(u2) * Math.cos(lambda));
        omega = Math.atan(sinOmega / cosOmega);
        double sinAlpha = (Math.cos(u1) * Math.cos(u2) * Math.sin(lambda)) / Math.sin(omega);
        cos2Alpha = 1 - (Math.pow(sinAlpha, 2));
        cos2OmegaM = cosOmega - ((2 * Math.sin(u1) * Math.sin(u2)) / cos2Alpha);
        double C = (f / 16.0) * cos2Alpha * (4 + (f * (4 - (3 * cos2Alpha))));
        double lambdaNew = L + ((1 - C) * f * sinAlpha * (omega
                + (C * sinOmega * (cos2OmegaM + (C * cosOmega * (-1 + (2 * Math.pow(cos2OmegaM, 2))))))));
        diff = Math.abs(lambdaNew - lambda);
        lambda = lambdaNew;// w w w .ja va  2 s . c  om
    }
    double uSquared = cos2Alpha * ((Math.pow(a, 2) - Math.pow(b, 2)) / Math.pow(b, 2));
    double A = 1 + ((uSquared / 16384.0)
            * (4096.0 + (uSquared * (-768.0 + (uSquared * (320.0 - (175.0 * uSquared)))))));
    double B = (uSquared / 1024.0) * (256.0 + (uSquared * (-128.0 + (uSquared * (74.0 - (47.0 * uSquared))))));
    double deltaOmega = B * sinOmega * (cos2OmegaM
            + (0.25 * B * ((cosOmega * (-1 + (2 * Math.pow(cos2OmegaM, 2)))) - ((1.0 / 6.0) * B * cos2OmegaM
                    * (-3.0 + (4.0 * Math.pow(sinOmega, 2))) * (-3.0 + (4.0 * Math.pow(cos2OmegaM, 2)))))));
    double s = b * A * (omega - deltaOmega);
    return s;
}

From source file:Matrix.java

/**
 *  Rotation  about an arbitrary Axis/* ww  w  .ja  va  2 s . c o m*/
 *  @param alpha the angle of the rotation
 *  @param p1 first axis point
 *  @param p2 second axis point
 *  @return the rotation matrix
 */
public static float[] matrixRotate(float alpha, float[] p1, float[] p2) {
    alpha = alpha * PI / 180f;

    float a1 = p1[0];
    float a2 = p1[1];
    float a3 = p1[2];

    //Compute the vector defines by point p1 and p2
    float v1 = p2[0] - a1;
    float v2 = p2[1] - a2;
    float v3 = p2[2] - a3;

    double theta = Math.atan2(v2, v1);
    double phi = Math.atan2(Math.sqrt(v1 * v1 + v2 * v2), v3);

    float cosAlpha, sinAlpha, sinPhi2;
    float cosTheta, sinTheta, cosPhi2;
    float cosPhi, sinPhi, cosTheta2, sinTheta2;

    cosPhi = (float) Math.cos(phi);
    cosTheta = (float) Math.cos(theta);
    cosTheta2 = (float) cosTheta * cosTheta;
    sinPhi = (float) Math.sin(phi);
    sinTheta = (float) Math.sin(theta);
    sinTheta2 = (float) sinTheta * sinTheta;

    sinPhi2 = (float) sinPhi * sinPhi;
    cosPhi2 = (float) cosPhi * cosPhi;

    cosAlpha = (float) Math.cos(alpha);
    sinAlpha = (float) Math.sin(alpha);

    float c = (float) 1.0 - cosAlpha;

    float r11, r12, r13, r14, r21, r22, r23, r24, r31, r32, r33, r34;
    r11 = cosTheta2 * (cosAlpha * cosPhi2 + sinPhi2) + cosAlpha * sinTheta2;
    r12 = sinAlpha * cosPhi + c * sinPhi2 * cosTheta * sinTheta;
    r13 = sinPhi * (cosPhi * cosTheta * c - sinAlpha * sinTheta);

    r21 = sinPhi2 * cosTheta * sinTheta * c - sinAlpha * cosPhi;
    r22 = sinTheta2 * (cosAlpha * cosPhi2 + sinPhi2) + cosAlpha * cosTheta2;
    r23 = sinPhi * (cosPhi * sinTheta * c + sinAlpha * cosTheta);

    r31 = sinPhi * (cosPhi * cosTheta * c + sinAlpha * sinTheta);
    r32 = sinPhi * (cosPhi * sinTheta * c - sinAlpha * cosTheta);
    r33 = cosAlpha * sinPhi2 + cosPhi2;

    r14 = a1 - a1 * r11 - a2 * r21 - a3 * r31;
    r24 = a2 - a1 * r12 - a2 * r22 - a3 * r32;
    r34 = a3 - a1 * r13 - a2 * r23 - a3 * r33;

    float[] m2 = { r11, r12, r13, 0f, r21, r22, r23, 0f, r31, r32, r33, 0f, r14, r24, r34, 1f };
    return m2;
}

From source file:net.sourceforge.processdash.ui.web.reports.RadarPlot.java

protected void drawRadar(Graphics2D g2, Rectangle2D plotArea, PlotRenderingInfo info, int pieIndex,
        PieDataset data) {//  w ww  .  j  a v  a 2 s . c o  m

    // adjust the plot area by the interior spacing value
    double gapHorizontal = plotArea.getWidth() * this.interiorGap;
    double gapVertical = plotArea.getHeight() * this.interiorGap;
    double radarX = plotArea.getX() + gapHorizontal / 2;
    double radarY = plotArea.getY() + gapVertical / 2;
    double radarW = plotArea.getWidth() - gapHorizontal;
    double radarH = plotArea.getHeight() - gapVertical;

    // make the radar area a square if the radar chart is to be circular...
    // NOTE that non-circular radar charts are not currently supported.
    if (true) { //circular) {
        double min = Math.min(radarW, radarH) / 2;
        radarX = (radarX + radarX + radarW) / 2 - min;
        radarY = (radarY + radarY + radarH) / 2 - min;
        radarW = 2 * min;
        radarH = 2 * min;
    }

    double radius = radarW / 2;
    double centerX = radarX + radarW / 2;
    double centerY = radarY + radarH / 2;

    Rectangle2D radarArea = new Rectangle2D.Double(radarX, radarY, radarW, radarH);

    // plot the data (unless the dataset is null)...
    if ((data != null) && (data.getKeys().size() > 0)) {

        // get a list of categories...
        List keys = data.getKeys();
        int numAxes = keys.size();

        // draw each of the axes on the radar chart, and register
        // the shape of the radar line.

        double multiplier = 1.0;
        GeneralPath lineShape = new GeneralPath(GeneralPath.WIND_NON_ZERO, numAxes + 1);
        GeneralPath gridShape = new GeneralPath(GeneralPath.WIND_NON_ZERO, numAxes + 1);

        int axisNumber = -1;
        Iterator iterator = keys.iterator();
        while (iterator.hasNext()) {
            Comparable currentKey = (Comparable) iterator.next();
            axisNumber++;
            Number dataValue = data.getValue(currentKey);

            double value = (dataValue != null ? dataValue.doubleValue() : 0);
            if (value > 1 || Double.isNaN(value) || Double.isInfinite(value))
                value = 1.0;
            if (value < 0)
                value = 0.0;
            multiplier *= value;

            double angle = 2 * Math.PI * axisNumber / numAxes;
            double deltaX = Math.sin(angle) * radius;
            double deltaY = -Math.cos(angle) * radius;

            // draw the spoke
            g2.setPaint(axisPaint);
            g2.setStroke(axisStroke);
            Line2D line = new Line2D.Double(centerX, centerY, centerX + deltaX, centerY + deltaY);
            g2.draw(line);

            // register the grid line and the shape line
            if (axisNumber == 0) {
                gridShape.moveTo((float) deltaX, (float) deltaY);
                lineShape.moveTo((float) (deltaX * value), (float) (deltaY * value));
            } else {
                gridShape.lineTo((float) deltaX, (float) deltaY);
                lineShape.lineTo((float) (deltaX * value), (float) (deltaY * value));
            }

            if (showAxisLabels) {
                // draw the label
                double labelX = centerX + deltaX * (1 + axisLabelGap);
                double labelY = centerY + deltaY * (1 + axisLabelGap);
                String label = currentKey.toString();
                drawLabel(g2, radarArea, label, axisNumber, labelX, labelY);
            }

        }
        gridShape.closePath();
        lineShape.closePath();

        // draw five gray concentric gridlines
        g2.translate(centerX, centerY);
        g2.setPaint(gridLinePaint);
        g2.setStroke(gridLineStroke);
        for (int i = 5; i > 0; i--) {
            Shape scaledGrid = gridShape
                    .createTransformedShape(AffineTransform.getScaleInstance(i / 5.0, i / 5.0));
            g2.draw(scaledGrid);
        }

        // get the color for the plot shape.
        Paint dataPaint = plotLinePaint;
        if (dataPaint == ADAPTIVE_COLORING) {
            //multiplier = Math.exp(Math.log(multiplier) * 2 / numAxes);
            dataPaint = getMultiplierColor((float) multiplier);
        }

        // compute a slightly transparent version of the plot color for
        // the fill.
        Paint dataFill = null;
        if (dataPaint instanceof Color && getForegroundAlpha() != 1.0)
            dataFill = new Color(((Color) dataPaint).getRed() / 255f, ((Color) dataPaint).getGreen() / 255f,
                    ((Color) dataPaint).getBlue() / 255f, getForegroundAlpha());
        else
            dataFill = dataPaint;

        // draw the plot shape.  First fill with a parially
        // transparent color, then stroke with the opaque color.
        g2.setPaint(dataFill);
        g2.fill(lineShape);
        g2.setPaint(dataPaint);
        g2.setStroke(plotLineStroke);
        g2.draw(lineShape);

        // cleanup the graphics context.
        g2.translate(-centerX, -centerY);
    }
}

From source file:msi.gaml.operators.Maths.java

@operator(value = "sin_rad", can_be_const = true, category = { IOperatorCategory.ARITHMETIC })
@doc(value = "Returns the value (in [-1,1]) of the sinus of the operand (in decimal degrees). The argument is casted to an int before being evaluated.", masterDoc = true, usages = @usage("Operand values out of the range [0-359] are normalized."), examples = {
        @example(value = "sin(360)", equals = "0.0") }, see = { "cos", "tan" })
public static Double sin_rad(final Double rv) {
    return Math.sin(rv);
}

From source file:de.biomedical_imaging.ij.steger.Width.java

public void compute_line_width(float[] dx, float[] dy, int width, int height, double sigma, int mode,
        boolean correct_pos, ArrayList<Line> contours, MutableInt num_contours) {
    float[] grad;
    int i, j, k;/*from  www.  ja v  a2  s. co m*/
    int r, c, l;
    int x, y, dir;
    Offset[] line;
    int max_line, num_line = 0;
    double length;
    Line cont;
    int num_points, max_num_points;
    double[] width_r, width_l;
    double[] grad_r, grad_l;
    double[] pos_x, pos_y, correct, asymm, contrast;
    double d, dr, dc, drr, drc, dcc;
    double i1, i2, i3, i4, i5, i6, i7, i8, i9;
    double t1, t2, t3, t4, t5, t6;
    double[] eigval = new double[2];
    double[][] eigvec = new double[2][2];
    double a, b, t = 0;
    int num = 0;
    double nx, ny;
    double n1, n2;
    double p1, p2;
    double val;
    double px, py;
    Position p = new Position();
    max_num_points = 0;
    for (i = 0; i < num_contours.getValue(); i++) {
        num_points = contours.get(i).num;
        if (num_points > max_num_points)
            max_num_points = num_points;
    }

    width_l = new double[max_num_points];
    width_r = new double[max_num_points];
    grad_l = new double[max_num_points];
    grad_r = new double[max_num_points];
    pos_x = new double[max_num_points];
    pos_y = new double[max_num_points];
    correct = new double[max_num_points];
    contrast = new double[max_num_points];
    asymm = new double[max_num_points];

    grad = new float[(width * height)];

    length = 2.5 * sigma;
    max_line = (int) Math.ceil(length * 3);
    line = new Offset[max_line];
    for (int o = 0; o < line.length; o++) {
        line[o] = new Offset();
    }

    /* Compute the gradient image. */
    for (r = 0; r < height; r++) {
        for (c = 0; c < width; c++) {
            l = LinesUtil.LINCOOR(r, c, width);
            grad[l] = (float) Math.sqrt(dx[l] * dx[l] + dy[l] * dy[l]);
        }
    }

    for (i = 0; i < num_contours.getValue(); i++) {
        cont = contours.get(i);
        num_points = cont.num;

        for (j = 0; j < num_points; j++) {
            px = cont.row[j];
            py = cont.col[j];
            pos_x[j] = px;
            pos_y[j] = py;
            r = (int) Math.floor(px + 0.5);
            c = (int) Math.floor(py + 0.5);
            nx = Math.cos(cont.angle[j]);
            ny = Math.sin(cont.angle[j]);
            /* Compute the search line. */
            MutableInt num_lineh = new MutableInt(num_line);
            bresenham(nx, ny, 0.0, 0.0, length, line, num_lineh);
            num_line = num_lineh.intValue();
            width_r[j] = width_l[j] = 0;
            /* Look on both sides of the line. */
            for (dir = -1; dir <= 1; dir += 2) {
                for (k = 0; k < num_line; k++) {
                    x = LinesUtil.BR(r + dir * line[k].x, height);
                    y = LinesUtil.BC(c + dir * line[k].y, width);
                    i1 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x - 1, height), LinesUtil.BC(y - 1, width),
                            width)];
                    i2 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x - 1, height), y, width)];
                    i3 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x - 1, height), LinesUtil.BC(y + 1, width),
                            width)];
                    i4 = grad[LinesUtil.LINCOOR(x, LinesUtil.BC(y - 1, width), width)];
                    i5 = grad[LinesUtil.LINCOOR(x, y, width)];
                    i6 = grad[LinesUtil.LINCOOR(x, LinesUtil.BC(y + 1, width), width)];
                    i7 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x + 1, height), LinesUtil.BC(y - 1, width),
                            width)];
                    i8 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x + 1, height), y, width)];
                    i9 = grad[LinesUtil.LINCOOR(LinesUtil.BR(x + 1, height), LinesUtil.BC(y + 1, width),
                            width)];
                    t1 = i1 + i2 + i3;
                    t2 = i4 + i5 + i6;
                    t3 = i7 + i8 + i9;
                    t4 = i1 + i4 + i7;
                    t5 = i2 + i5 + i8;
                    t6 = i3 + i6 + i9;
                    dr = (t3 - t1) / 6;
                    dc = (t6 - t4) / 6;
                    drr = (t1 - 2 * t2 + t3) / 6;
                    dcc = (t4 - 2 * t5 + t6) / 6;
                    drc = (i1 - i3 - i7 + i9) / 4;
                    p.compute_eigenvals(2 * drr, drc, 2 * dcc, eigval, eigvec);
                    val = -eigval[0];
                    if (val > 0.0) {
                        n1 = eigvec[0][0];
                        n2 = eigvec[0][1];
                        a = 2.0 * (drr * n1 * n1 + drc * n1 * n2 + dcc * n2 * n2);
                        b = dr * n1 + dc * n2;
                        MutableDouble th = new MutableDouble(t);
                        MutableInt numh = new MutableInt(num);
                        p.solve_linear(a, b, th, numh);
                        t = th.getValue();
                        num = numh.getValue();
                        if (num != 0) {
                            p1 = t * n1;
                            p2 = t * n2;
                            if (Math.abs(p1) <= 0.5 && Math.abs(p2) <= 0.5) {
                                /* Project the maximum point position perpendicularly onto the
                                   search line. */
                                a = 1;
                                b = nx * (px - (r + dir * line[k].x + p1))
                                        + ny * (py - (c + dir * line[k].y + p2));
                                th = new MutableDouble(t);
                                numh = new MutableInt(num);
                                p.solve_linear(a, b, th, numh);
                                t = th.getValue();
                                num = numh.getValue();
                                d = (-i1 + 2 * i2 - i3 + 2 * i4 + 5 * i5 + 2 * i6 - i7 + 2 * i8 - i9) / 9;
                                if (dir == 1) {
                                    grad_r[j] = d + p1 * dr + p2 * dc + p1 * p1 * drr + p1 * p2 * drc
                                            + p2 * p2 * dcc;
                                    width_r[j] = Math.abs(t);
                                } else {
                                    grad_l[j] = d + p1 * dr + p2 * dc + p1 * p1 * drr + p1 * p2 * drc
                                            + p2 * p2 * dcc;
                                    width_l[j] = Math.abs(t);
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }

        fix_locations(width_l, width_r, grad_l, grad_r, pos_x, pos_y, correct, contrast, asymm, sigma, mode,
                correct_pos, cont);
    }
}

From source file:VerticalViewPager.java

float distanceInfluenceForSnapDuration(float f) {
    f -= 0.5f; // center the values about 0.
    f *= 0.3f * Math.PI / 2.0f;/* w w w.  j a v  a  2s. c  o m*/
    return (float) Math.sin(f);
}