Example usage for java.lang Math PI

List of usage examples for java.lang Math PI

Introduction

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

Prototype

double PI

To view the source code for java.lang Math PI.

Click Source Link

Document

The double value that is closer than any other to pi, the ratio of the circumference of a circle to its diameter.

Usage

From source file:com.alvermont.terraj.planet.project.SquareProjection.java

/**
 * Carry out the projection/*from ww w.j  a  va2  s .  c  om*/
 */
public void project() {
    setcolours();

    final int width = getParameters().getProjectionParameters().getWidth();
    final int height = getParameters().getProjectionParameters().getHeight();

    final double lat = getParameters().getProjectionParameters().getLatitudeRadians();
    final double lon = getParameters().getProjectionParameters().getLongitudeRadians();

    final double scale = getParameters().getProjectionParameters().getScale();

    final double hgrid = getParameters().getProjectionParameters().getHgrid();
    final double vgrid = getParameters().getProjectionParameters().getVgrid();

    final boolean doShade = getParameters().getProjectionParameters().isDoShade();

    depth = (3 * ((int) (log2(scale * height)))) + 6;

    cacheParameters();

    colours = new short[width][height];
    shades = new short[width][height];

    double y;
    double scale1;
    double theta1;
    double cos2;
    int k;
    int i;
    int j;

    k = (int) ((lat * width * scale) / Math.PI);

    progress.progressStart(height, "Generating Terrain");

    for (j = 0; j < height; ++j) {
        progress.progressStep(j);

        y = ((2.0 * (j - k)) - height) / width / scale * Math.PI;

        if (Math.abs(y) >= (0.5 * Math.PI)) {
            for (i = 0; i < width; ++i) {
                colours[i][j] = backgroundColour;

                if (doShade) {
                    shades[i][j] = 255;
                }
            }
        } else {
            cos2 = Math.cos(y);

            if (cos2 > 0.0) {
                scale1 = (scale * width) / height / cos2 / Math.PI;
                depth = (3 * ((int) (log2(scale1 * height)))) + 3;

                for (i = 0; i < width; ++i) {
                    theta1 = lon - (0.5 * Math.PI) + ((Math.PI * ((2.0 * i) - width)) / width / scale);

                    colours[i][j] = (short) planet0(Math.cos(theta1) * cos2, Math.sin(y),
                            -Math.sin(theta1) * cos2);

                    if (doShade) {
                        shades[i][j] = shade;
                    }
                }
            }
        }
    }

    progress.progressComplete("Terrain Generated");

    if (hgrid != 0.0) {
        /* draw horizontal gridlines */
        for (theta1 = 0.0; theta1 > -90.0; theta1 -= hgrid)
            ;

        for (theta1 = theta1; theta1 < 90.0; theta1 += hgrid) {
            y = Math.toRadians(theta1);

            j = (height / 2) + (int) ((0.5 * y * width * scale) / Math.PI) + k;

            if ((j >= 0) && (j < height)) {
                for (i = 0; i < width; ++i)
                    colours[i][j] = BLACK;
            }
        }
    }

    if (vgrid != 0.0) {
        /* draw vertical gridlines */
        for (theta1 = 0.0; theta1 > -360.0; theta1 -= vgrid)
            ;

        for (theta1 = theta1; theta1 < 360.0; theta1 += vgrid) {
            i = (int) (0.5 * width * (1.0 + ((scale * (Math.toRadians(theta1) - lon)) / Math.PI)));

            if ((i >= 0) && (i < width)) {
                for (j = Math.max(0,
                        (height / 2) - (int) ((0.25 * Math.PI * width * scale) / Math.PI) + k); j < Math.min(
                                height,
                                (height / 2) + (int) ((0.25 * Math.PI * width * scale) / Math.PI) + k); ++j) {
                    colours[i][j] = BLACK;
                }
            }
        }
    }

    if (doShade) {
        smoothshades();
    }

    doOutlining();
}

From source file:LoaderTest.java

protected BranchGroup createSceneBranchGroup() {
    BranchGroup objRoot = super.createSceneBranchGroup();

    // create a TransformGroup to flip the hand onto its end and enlarge it.
    TransformGroup objTrans1 = new TransformGroup();
    Transform3D tr = new Transform3D();
    objTrans1.getTransform(tr);// w w w  .ja  v a  2s.c  om
    tr.rotX(90.0 * Math.PI / 180.0);
    tr.setScale(10.0);
    objTrans1.setTransform(tr);

    // create a TransformGroup to rotate the hand
    TransformGroup objTrans2 = new TransformGroup();
    objTrans2.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objTrans2.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

    // create a RotationInterpolator behavior to rotate the hand
    Transform3D yAxis = new Transform3D();
    Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0);

    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans2, yAxis, 0.0f,
            (float) Math.PI * 2.0f);
    rotator.setSchedulingBounds(bounds);
    objTrans2.addChild(rotator);

    // Set up the global lights
    Color3f lColor1 = new Color3f(0.7f, 0.7f, 0.7f);
    Vector3f lDir1 = new Vector3f(-1.0f, -1.0f, -1.0f);
    Color3f alColor = new Color3f(0.2f, 0.2f, 0.2f);

    AmbientLight aLgt = new AmbientLight(alColor);
    aLgt.setInfluencingBounds(bounds);
    DirectionalLight lgt1 = new DirectionalLight(lColor1, lDir1);
    lgt1.setInfluencingBounds(bounds);

    objRoot.addChild(aLgt);
    objRoot.addChild(lgt1);

    // load the object file
    Scene scene = null;
    Shape3D shape = null;

    // read in the geometry information from the data file
    ObjectFile objFileloader = new ObjectFile(ObjectFile.RESIZE);

    try {
        scene = objFileloader.load("hand1.obj");
    } catch (Exception e) {
        scene = null;
        System.err.println(e);
    }

    if (scene == null)
        System.exit(1);

    // retrieve the Shape3D object from the scene
    BranchGroup branchGroup = scene.getSceneGroup();
    shape = (Shape3D) branchGroup.getChild(0);

    // create an Appearance and Material
    Appearance app = new Appearance();
    Color3f objColor = new Color3f(1.0f, 0.7f, 0.8f);
    Color3f black = new Color3f(0.0f, 0.0f, 0.0f);
    app.setMaterial(new Material(objColor, black, objColor, black, 80.0f));

    // assign the appearance to the Shape
    shape.setAppearance(app);

    // connect the scenegraph
    objTrans2.addChild(scene.getSceneGroup());
    objTrans1.addChild(objTrans2);
    objRoot.addChild(objTrans1);

    return objRoot;
}

From source file:com.opengamma.analytics.financial.interestrate.swaption.method.SwaptionPhysicalFixedIborG2ppNumericalIntegrationMethod.java

/**
 * Computes the present value of the Physical delivery swaption through approximation..
 * @param swaption The swaption.//from www  .j av a  2  s .  c o m
 * @param g2Data The G2++ parameters and the curves.
 * @return The present value.
 */
public CurrencyAmount presentValue(final SwaptionPhysicalFixedIbor swaption,
        final G2ppPiecewiseConstantDataBundle g2Data) {
    YieldAndDiscountCurve dsc = g2Data.getCurve(swaption.getUnderlyingSwap().getFixedLeg().getDiscountCurve());
    AnnuityPaymentFixed cfe = CFEC.visit(swaption.getUnderlyingSwap(), g2Data);
    double theta = swaption.getTimeToExpiry();
    int nbCf = cfe.getNumberOfPayments();
    double[] t = new double[nbCf];
    double[] df = new double[nbCf];
    double[] discountedCashFlow = new double[nbCf];
    for (int loopcf = 0; loopcf < nbCf; loopcf++) {
        t[loopcf] = cfe.getNthPayment(loopcf).getPaymentTime();
        df[loopcf] = dsc.getDiscountFactor(cfe.getNthPayment(loopcf).getPaymentTime());
        discountedCashFlow[loopcf] = df[loopcf] * cfe.getNthPayment(loopcf).getAmount();
    }

    double rhog2pp = g2Data.getG2ppParameter().getCorrelation();
    double[][] htheta = MODEL_G2PP.volatilityMaturityPart(g2Data.getG2ppParameter(), theta, t);
    double[][] gamma = MODEL_G2PP.gamma(g2Data.getG2ppParameter(), 0, theta);
    double[][] alpha = new double[2][nbCf];
    double[] tau2 = new double[nbCf];
    for (int loopcf = 0; loopcf < nbCf; loopcf++) {
        alpha[0][loopcf] = Math.sqrt(gamma[0][0]) * htheta[0][loopcf];
        alpha[1][loopcf] = Math.sqrt(gamma[1][1]) * htheta[1][loopcf];
        tau2[loopcf] = alpha[0][loopcf] * alpha[0][loopcf] + alpha[1][loopcf] * alpha[1][loopcf]
                + 2 * rhog2pp * gamma[0][1] * htheta[0][loopcf] * htheta[1][loopcf];
    }
    double rhobar = rhog2pp * gamma[0][1] / Math.sqrt(gamma[0][0] * gamma[1][1]);

    final SwaptionIntegrant integrant = new SwaptionIntegrant(discountedCashFlow, alpha, tau2, rhobar);
    final double limit = 12.0;
    final double absoluteTolerance = 1.0E-1;
    final double relativeTolerance = 1.0E-6;
    final RungeKuttaIntegrator1D integrator1D = new RungeKuttaIntegrator1D(absoluteTolerance, relativeTolerance,
            NB_INTEGRATION);
    IntegratorRepeated2D integrator2D = new IntegratorRepeated2D(integrator1D);
    double pv = 0.0;
    try {
        pv = 1.0 / (2.0 * Math.PI * Math.sqrt(1 - rhobar * rhobar)) * integrator2D.integrate(integrant,
                new Double[] { -limit, -limit }, new Double[] { limit, limit });
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
    return CurrencyAmount.of(swaption.getCurrency(), pv * (swaption.isLong() ? 1.0 : -1.0));
}

From source file:Similaridade.GraficosSimilaridade.java

public static XYDataset newDataset2OndasComDeslocada(CapturaAtual onda1, CapturaAtual onda2, int deslocamento,
        double correlacao) {
    //metodo que cria um CategoryDataset para ser usado em grafico de linhas                
    float valOnda1[] = new float[Configuracoes.PONTOSONDA];
    float valOnda2[] = new float[Configuracoes.PONTOSONDA];
    float sen1[] = new float[Configuracoes.HARMONICAS];
    float cos1[] = new float[Configuracoes.HARMONICAS];
    float sen2[] = new float[Configuracoes.HARMONICAS];
    float cos2[] = new float[Configuracoes.HARMONICAS];
    int i;/*from  w ww  . j a va  2s  .c om*/

    float s1, s2, tempo[] = new float[Configuracoes.PONTOSONDA];
    XYSeriesCollection result = new XYSeriesCollection();

    for (i = 0; i < Configuracoes.HARMONICAS; i++) {
        sen1[i] = 0;
        cos1[i] = 0;
        sen2[i] = 0;
        cos2[i] = 0;
    }

    i = 0;
    for (HarmAtual oa : onda1.getHarmAtual()) {
        sen1[i] = oa.getSen();
        cos1[i] = oa.getCos();
        i++;
    }

    i = 0;
    for (HarmAtual oa : onda2.getHarmAtual()) {
        sen2[i] = oa.getSen();
        cos2[i] = oa.getCos();
        i++;
    }

    XYSeries series1 = new XYSeries(String.valueOf(onda1.getCodCaptura()));
    XYSeries series3 = new XYSeries("Shift " + String.valueOf(onda2.getCodCaptura()));

    tempo[0] = 0; //(float) 1 / 60;
    for (i = 0; i < Configuracoes.PONTOSONDA; i++) {
        if (TIRADOVM == 0) {
            s1 = onda1.getValorMedio() / 2;
            s2 = onda2.getValorMedio() / 2;
        } else {
            s1 = onda1.getValorMedio();
            s2 = onda2.getValorMedio();
        }

        for (int x = 0; x < Configuracoes.HARMONICAS; x++) {
            if (TIRADOVM == 0) {
                s1 += (float) (sen1[x] * Math.sin(2 * Math.PI * ((x + 1) * Configuracoes.FREQBASE) * tempo[i]))
                        + (cos1[x] * Math.cos(-2 * Math.PI * ((x + 1) * Configuracoes.FREQBASE) * tempo[i]));
                s2 += (float) (sen2[x] * Math.sin(2 * Math.PI * ((x + 1) * Configuracoes.FREQBASE) * tempo[i]))
                        + (cos2[x] * Math.cos(-2 * Math.PI * ((x + 1) * Configuracoes.FREQBASE) * tempo[i]));
            } else {
                s1 += (float) (sen1[x] * Math.sin(2 * Math.PI * ((x + 1) * Configuracoes.FREQBASE) * tempo[i]))
                        + (cos1[x] * Math.cos(2 * Math.PI * ((x + 1) * Configuracoes.FREQBASE) * tempo[i]));
                s2 += (float) (sen2[x] * Math.sin(2 * Math.PI * ((x + 1) * Configuracoes.FREQBASE) * tempo[i]))
                        + (cos2[x] * Math.cos(2 * Math.PI * ((x + 1) * Configuracoes.FREQBASE) * tempo[i]));
            }
        }
        if (TIRADOVM == 0) {
            valOnda1[i] = (int) ((s1 * (2.0)) / 256.0);
            valOnda1[i] = (valOnda1[i] - onda1.getOffset());
            valOnda2[i] = (int) ((s2 * (2.0)) / 256.0);
            valOnda2[i] = (valOnda2[i] - onda2.getOffset());

        } else {
            valOnda1[i] = (s1);
            valOnda2[i] = (s2);
        }
        valOnda1[i] = (valOnda1[i]) / onda1.getGain();
        valOnda2[i] = (valOnda2[i]) / onda2.getGain();

        series1.add(tempo[i] * 1000, valOnda1[i]);

        if (i == (Configuracoes.PONTOSONDA - 1)) {
            break;
        }
        tempo[i + 1] = (tempo[i] + (float) (1.0 / (60 * 256)));
    }

    int j = 0;
    if (correlacao < 0) {
        for (i = 0; i < Configuracoes.PONTOSONDA; i++) {
            if ((i + deslocamento) <= (Configuracoes.PONTOSONDA - 1)) {
                series3.add(tempo[i] * 1000, -1 * valOnda2[i + deslocamento]);
            } else {
                series3.add(tempo[i] * 1000, -1 * valOnda2[j++]);
            }
        }
    } else {
        for (i = 0; i < Configuracoes.PONTOSONDA; i++) {
            if ((i + deslocamento) <= (Configuracoes.PONTOSONDA - 1)) {
                series3.add(tempo[i] * 1000, valOnda2[i + deslocamento]);
            } else {
                series3.add(tempo[i] * 1000, valOnda2[j++]);
            }
        }
    }

    result.addSeries(series1);
    result.addSeries(series3);

    return result;
}

From source file:electrical_parameters.CDER.java

public CDER(RealMatrix Dik, RealMatrix Dik_mirror_real, RealMatrix Dik_mirror_imag, double[] hx2_real,
        double[] hx2_imag, ArrayList<elpam_input_conductor> cnd_list, boolean exact_GMR, boolean exact_Rac,
        int fv, int gw) {
    //        GMR_calculation cnd = new GMR_calculation(Conductor);
    //        Rac_calculation cnd2 = new Rac_calculation(Conductor);

    this.rows = Dik.getRowDimension();
    this.cols = Dik.getColumnDimension();
    this.GMR = new double[cnd_list.size()];
    this.R_cnd = new double[cnd_list.size()];
    this.fv = fv;
    this.gw = gw;

    if (exact_GMR) {
        for (int i = 0; i < cnd_list.size(); i++) {
            this.GMR[i] = cnd_list.get(i).getGMR();
        }/*from  ww w  .  j a  v a 2s  .  c o  m*/
    } else {
        for (int i = 0; i < cnd_list.size(); i++) {
            this.GMR[i] = cnd_list.get(i).getGMR_default();
        }
    }

    if (exact_Rac) {
        for (int i = 0; i < cnd_list.size(); i++) {
            this.R_cnd[i] = cnd_list.get(i).getRac();
        }
    } else {
        for (int i = 0; i < cnd_list.size(); i++) {
            this.R_cnd[i] = cnd_list.get(i).getRdc();
        }
    }

    this.Dik = Dik;
    this.Dik_mirror_CDER_real = Dik_mirror_real;
    this.Dik_mirror_CDER_imag = Dik_mirror_imag;
    this.hx2_real = hx2_real;
    this.hx2_imag = hx2_imag;
    this.f = constants.getFrequency();

    this.R_real = initMatrix(Dik);
    this.L_real = initMatrix(Dik);
    this.L_imag = initMatrix(Dik);
    this.X_real = initMatrix(Dik);
    this.X_imag = initMatrix(Dik);
    this.Z = initComplexMatrix(Dik);

    this.R_red = new Array2DRowRealMatrix(fv, fv);
    this.L_red = new Array2DRowRealMatrix(fv, fv);
    this.X_red = new Array2DRowRealMatrix(fv, fv);
    this.Z_red = new ComplexMatrix(fv, fv);

    this.R_red_symm = new Array2DRowRealMatrix(fv, fv);
    this.L_red_symm = new Array2DRowRealMatrix(fv, fv);
    this.X_red_symm = new Array2DRowRealMatrix(fv, fv);
    this.Z_red_symm = new ComplexMatrix(fv, fv);

    this.omega = (double) 2 * Math.PI * this.f;
    this.mu = (4e-4) * Math.PI;
    this.mu2pi = (mu / (2 * Math.PI));
    this.rows = Dik.getRowDimension();
    this.cols = Dik.getColumnDimension();
}

From source file:net.sf.dynamicreports.test.jasper.chart.AreaChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);// w  ww. j  av  a2  s .co  m

    JFreeChart chart = getChart("summary.chart1", 0);
    Axis axis = chart.getCategoryPlot().getDomainAxis();
    CategoryPlot categoryPlot = chart.getCategoryPlot();
    Assert.assertEquals("renderer", AreaRenderer.class, categoryPlot.getRenderer().getClass());
    Assert.assertEquals("category label", "category", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    CategoryLabelPosition labelPosition = chart.getCategoryPlot().getDomainAxis().getCategoryLabelPositions()
            .getLabelPosition(RectangleEdge.LEFT);
    Assert.assertEquals("plot label rotation", (45d / 180) * Math.PI, labelPosition.getAngle());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart2", 0);
    axis = chart.getCategoryPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
    Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
    Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
}

From source file:com.alvermont.terraj.planet.project.MercatorProjection.java

/**
 * Carry out the projection/*w w  w .  j  a  v  a 2  s.  c o  m*/
 */
public void project() {
    setcolours();

    final int width = getParameters().getProjectionParameters().getWidth();
    final int height = getParameters().getProjectionParameters().getHeight();

    final double lat = getParameters().getProjectionParameters().getLatitudeRadians();
    final double lon = getParameters().getProjectionParameters().getLongitudeRadians();

    final double scale = getParameters().getProjectionParameters().getScale();

    final double hgrid = getParameters().getProjectionParameters().getHgrid();
    final double vgrid = getParameters().getProjectionParameters().getVgrid();

    final boolean doShade = getParameters().getProjectionParameters().isDoShade();

    cacheParameters();

    colours = new short[width][height];
    shades = new short[width][height];

    double y;
    double scale1;
    double cos2;
    double theta1;
    int i;
    int j;
    int k;

    y = Math.sin(lat);
    y = (1.0 + y) / (1.0 - y);
    y = 0.5 * Math.log(y);
    k = (int) ((0.5 * y * width * scale) / Math.PI);

    progress.progressStart(height, "Generating Terrain");

    for (j = 0; j < height; ++j) {
        //            if (debug && ((j % (Height/25)) == 0))
        //            {fprintf(stderr, "%c", view); fflush(stderr);}
        progress.progressStep(j);

        y = (Math.PI * ((2.0 * (j - k)) - height)) / width / scale;
        y = Math.exp(2. * y);
        y = (y - 1.) / (y + 1.);

        scale1 = (scale * width) / height / Math.sqrt(1.0 - (y * y)) / Math.PI;

        cos2 = Math.sqrt(1.0 - (y * y));
        depth = (3 * ((int) (log2(scale1 * height)))) + 3;

        for (i = 0; i < width; ++i) {
            theta1 = lon - (0.5 * Math.PI) + ((Math.PI * ((2.0 * i) - width)) / width / scale);
            colours[i][j] = (short) planet0(Math.cos(theta1) * cos2, y, -Math.sin(theta1) * cos2);

            if (doShade) {
                shades[i][j] = shade;
            }
        }
    }

    progress.progressComplete("Terrain Generated");

    if (hgrid != 0.0) {
        /* draw horizontal gridlines */
        for (theta1 = 0.0; theta1 > -90.0; theta1 -= hgrid)
            ;

        for (theta1 = theta1; theta1 < 90.0; theta1 += hgrid) {
            y = Math.sin(Math.toRadians(theta1));
            y = (1.0 + y) / (1.0 - y);
            y = 0.5 * Math.log(y);
            j = (height / 2) + (int) ((0.5 * y * width * scale) / Math.PI) + k;

            if ((j >= 0) && (j < height)) {
                for (i = 0; i < width; ++i)
                    colours[i][j] = BLACK;
            }
        }
    }

    if (vgrid != 0.0) {
        /* draw vertical gridlines */
        for (theta1 = 0.0; theta1 > -360.0; theta1 -= vgrid)
            ;

        for (theta1 = theta1; theta1 < 360.0; theta1 += vgrid) {
            i = (int) (0.5 * width * (1.0 + ((scale * (Math.toRadians(theta1) - lon)) / Math.PI)));

            if ((i >= 0) && (i < width)) {
                for (j = 0; j < height; ++j)
                    colours[i][j] = BLACK;
            }
        }
    }

    if (doShade) {
        smoothshades();
    }
}

From source file:org.jstockchart.axis.TimeseriesNumberAxis.java

public List<Tick> refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) {
    TextAnchor anchor = null;/*  w w  w  . jav  a 2  s.co  m*/
    TextAnchor rotationAnchor = null;
    double angle = 0.0;
    if (isVerticalTickLabels()) {
        anchor = TextAnchor.BOTTOM_CENTER;
        rotationAnchor = TextAnchor.BOTTOM_CENTER;
        if (edge == RectangleEdge.LEFT) {
            angle = -Math.PI / 2.0;
        } else {
            angle = Math.PI / 2.0;
        }
    } else {
        if (edge == RectangleEdge.LEFT) {
            anchor = TextAnchor.CENTER_RIGHT;
            rotationAnchor = TextAnchor.CENTER_RIGHT;
        } else {
            anchor = TextAnchor.CENTER_LEFT;
            rotationAnchor = TextAnchor.CENTER_LEFT;
        }
    }
    return createTicks(logicTicks, anchor, rotationAnchor, angle);
}

From source file:MixedTest.java

protected BranchGroup createSceneBranchGroup() {
    BranchGroup objRoot = super.createSceneBranchGroup();

    TransformGroup objTrans = new TransformGroup();
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
    objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);

    BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0), 100.0);

    Transform3D yAxis = new Transform3D();
    Alpha rotationAlpha = new Alpha(-1, Alpha.INCREASING_ENABLE, 0, 0, 4000, 0, 0, 0, 0, 0);

    RotationInterpolator rotator = new RotationInterpolator(rotationAlpha, objTrans, yAxis, 0.0f,
            (float) Math.PI * 2.0f);
    rotator.setSchedulingBounds(bounds);
    objTrans.addChild(rotator);/*  w  w w.j  av a 2 s. c o m*/

    objTrans.addChild(new ColorCube());
    objRoot.addChild(objTrans);

    return objRoot;
}

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

protected double getSectionVolume(BoreSection section) {
    double leftRadius = section.getLeftRadius();
    double rightRadius = section.getRightRadius();
    double length = section.getLength();

    double volume = Math.PI * length
            * (leftRadius * leftRadius + leftRadius * rightRadius + rightRadius * rightRadius) / 3.;

    return volume;
}