Example usage for java.lang Math toRadians

List of usage examples for java.lang Math toRadians

Introduction

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

Prototype

public static double toRadians(double angdeg) 

Source Link

Document

Converts an angle measured in degrees to an approximately equivalent angle measured in radians.

Usage

From source file:magma.agent.behavior.complex.GoalieBehavior.java

private boolean isSafeToKick() {
    // ball kick-able, goalie facing the ball and kick angle away from the
    // goal/*from   www. ja v  a 2s .  c  o m*/
    double ballAngle = worldModel.getBall().getHorizontalDirection();
    if (worldModel.getThisPlayer().getDistanceTo(worldModel.getBall()) < 0.3 && ballAngle > Math.toRadians(-60)
            && ballAngle < Math.toRadians(60) && worldModel.getThisPlayer().getPosition().getZ() < 1.6
            && worldModel.getThisPlayer().getPosition().getZ() > -1.6) {

        return true;
    }

    // log
    // logger.log(Level.FINE,
    // "safe to kick is false : ({0}, {1}, {2})",
    // new Object[] { newPosition.getX(), newPosition.getY(),
    // newPosition.getZ() });

    return false;
}

From source file:org.apache.jetspeed.security.mfa.impl.CaptchaImageResource.java

public void init() {
    boolean emptyBackground = true;
    if (config.isUseImageBackground() && background != null) {
        ByteArrayInputStream is = new ByteArrayInputStream(background);
        JPEGImgDecoder decoder = new DefaultJPEGImgDecoder();
        try {//  w  w  w. j  a  v  a 2 s  .c o  m
            this.image = decoder.decodeAsBufferedImage(is);
            this.width = image.getWidth();
            this.height = image.getHeight();
            emptyBackground = false;
        } catch (Exception e) {
            emptyBackground = true;
        }
    }
    if (emptyBackground) {
        this.width = config.getTextMarginLeft() * 2;
        this.height = config.getTextMarginBottom() * 6;
    }
    char[] chars = challengeId.toCharArray();
    charAttsList = new ArrayList();
    TextLayout text = null;
    AffineTransform textAt = null;
    String[] fontNames = config.getFontNames();
    for (int i = 0; i < chars.length; i++) {
        // font name
        String fontName = (fontNames.length == 1) ? fontNames[0] : fontNames[randomInt(0, fontNames.length)];

        // rise
        int rise = config.getTextRiseRange();
        if (rise > 0) {
            rise = randomInt(config.getTextMarginBottom(),
                    config.getTextMarginBottom() + config.getTextRiseRange());
        }

        if (config.getTextShear() > 0.0 || config.getTextRotation() > 0) {
            // rotation
            double dRotation = 0.0;
            if (config.getTextRotation() > 0) {
                dRotation = Math.toRadians(randomInt(-(config.getTextRotation()), config.getTextRotation()));
            }

            // shear
            double shearX = 0.0;
            double shearY = 0.0;
            if (config.getTextShear() > 0.0) {
                Random ran = new Random();
                shearX = ran.nextDouble() * config.getTextShear();
                shearY = ran.nextDouble() * config.getTextShear();
            }
            CharAttributes cf = new CharAttributes(chars[i], fontName, dRotation, rise, shearX, shearY);
            charAttsList.add(cf);
            text = new TextLayout(chars[i] + "", getFont(fontName),
                    new FontRenderContext(null, config.isFontAntialiasing(), false));
            textAt = new AffineTransform();
            if (config.getTextRotation() > 0)
                textAt.rotate(dRotation);
            if (config.getTextShear() > 0.0)
                textAt.shear(shearX, shearY);
        } else {
            CharAttributes cf = new CharAttributes(chars[i], fontName, 0, rise, 0.0, 0.0);
            charAttsList.add(cf);
        }
        if (emptyBackground) {
            Shape shape = text.getOutline(textAt);
            //                this.width += text.getBounds().getWidth();
            this.width += (int) shape.getBounds2D().getWidth();
            this.width += config.getTextSpacing() + 1;
            if (this.height < (int) shape.getBounds2D().getHeight() + rise) {
                this.height = (int) shape.getBounds2D().getHeight() + rise;
            }
        }
    }
    if (emptyBackground) {
        this.image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics2D gfx = (Graphics2D) this.image.getGraphics();
        gfx.setBackground(Color.WHITE);
        gfx.clearRect(0, 0, width, height);
    }
}

From source file:android.support.transition.ArcMotion.java

private static float toTangent(float arcInDegrees) {
    if (arcInDegrees < 0 || arcInDegrees > 90) {
        throw new IllegalArgumentException("Arc must be between 0 and 90 degrees");
    }//from   w ww.  j  a  va  2  s  .  c  o m
    return (float) Math.tan(Math.toRadians(arcInDegrees / 2));
}

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

/**
 * Carry out the projection/*from   www.  ja va  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();

    cacheParameters();

    final double sla = Math.sin(lat);
    final double cla = Math.cos(lat);
    final double slo = Math.sin(lon);
    final double clo = Math.cos(lon);

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

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

    double x;
    double y;
    double z;
    double x1;
    double y1;
    double z1;
    double zz;
    double theta1;
    double theta2;
    double ymin;
    double ymax;
    int i;
    int j;

    ymin = 2.0;
    ymax = -2.0;

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

    log.debug("Azimuth projection starting with seed " + getParameters().getPlanetParameters().getSeed());

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

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

        for (i = 0; i < width; ++i) {
            x = ((2.0 * i) - width) / height / scale;
            y = ((2.0 * j) - height) / height / scale;
            zz = (x * x) + (y * y);
            z = 1.0 - (0.5 * zz);

            if (z < -1.0) {
                colours[i][j] = backgroundColour;

                if (doShade) {
                    shades[i][j] = 255;
                }
            } else {
                zz = Math.sqrt(1.0 - (0.25 * zz));
                x = x * zz;
                y = y * zz;

                x1 = (clo * x) + (slo * sla * y) + (slo * cla * z);
                y1 = (cla * y) - (sla * z);
                z1 = (-slo * x) + (clo * sla * y) + (clo * cla * z);

                if (y1 < ymin) {
                    ymin = y1;
                }

                if (y1 > ymax) {
                    ymax = y1;
                }

                colours[i][j] = (short) planet0(x1, y1, z1);

                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));

            if ((ymin <= y) && (y <= ymax)) {
                zz = Math.sqrt(1 - (y * y));

                for (theta2 = -Math.PI; theta2 < Math.PI; theta2 += (0.5 / width / scale)) {
                    x = Math.sin(theta2) * zz;
                    z = Math.cos(theta2) * zz;

                    x1 = (clo * x) - (slo * z);
                    y1 = (slo * sla * x) + (cla * y) + (clo * sla * z);
                    z1 = (slo * cla * x) - (sla * y) + (clo * cla * z);

                    if (z1 != -1.0) {
                        i = (int) (0.5 * (((height * scale * x1) / Math.sqrt(0.5 + (0.5 * z1))) + width));
                        j = (int) (0.5 * (((height * scale * y1) / Math.sqrt(0.5 + (0.5 * z1))) + height));

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

    if (vgrid != 0.0) {
        /* draw vertical gridlines */
        for (theta2 = -Math.PI; theta2 < Math.PI; theta2 += (0.5 / width / scale)) {
            y = Math.sin(theta2);

            if ((ymin <= y) && (y <= ymax)) {
                for (theta1 = 0.0; theta1 < 360.0; theta1 += vgrid) {
                    x = Math.sin(Math.toRadians(theta1)) * Math.cos(theta2);
                    z = Math.cos(Math.toRadians(theta1)) * Math.cos(theta2);

                    x1 = (clo * x) - (slo * z);
                    y1 = (slo * sla * x) + (cla * y) + (clo * sla * z);
                    z1 = (slo * cla * x) - (sla * y) + (clo * cla * z);

                    if (z1 != -1.0) {
                        i = (int) (0.5 * (((height * scale * x1) / Math.sqrt(0.5 + (0.5 * z1))) + width));
                        j = (int) (0.5 * (((height * scale * y1) / Math.sqrt(0.5 + (0.5 * z1))) + height));

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

    if (doShade) {
        smoothshades();
    }

    doOutlining();
}

From source file:com.robsterthelobster.ucibustracker.ArrivalsFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle bundle) {

    String sortOrder;// w w w. j a va 2  s  . c  om
    String location = "";
    if (Utility.isLocationLatLonAvailable(getContext())) {
        double latitude = Utility.getLocationLatitude(getContext());
        double longitude = Utility.getLocationLongitude(getContext());

        double fudge = Math.pow(Math.cos(Math.toRadians(latitude)), 2);

        String latOrder = "(" + latitude + " - " + BusContract.StopEntry.LATITUDE + ")";
        String longOrder = "(" + longitude + " - " + BusContract.StopEntry.LONGITUDE + ")";
        location = "(" + latOrder + "*" + latOrder + "+" + longOrder + "*" + longOrder + "*" + fudge + "), ";
    }

    switch (id) {
    case ARRIVAL_LOADER:
        // FAVORITES, THEN ARRIVAL TIME
        sortOrder = BusContract.FavoriteEntry.FAVORITE + " DESC, " + location
                + BusContract.ArrivalEntry.SECONDS_TO_ARRIVAL + " ASC";
        return new CursorLoader(getContext(), BusContract.ArrivalEntry.CONTENT_URI, ARRIVAL_COLUMNS,
                BusContract.ArrivalEntry.IS_CURRENT + " =? ", new String[] { "1" }, sortOrder);
    case STOP_ARRIVAL_LOADER:
        return new CursorLoader(getContext(), BusContract.ArrivalEntry.CONTENT_URI, ARRIVAL_COLUMNS,
                BusContract.ArrivalEntry.IS_CURRENT + " = ?" + " AND " + BusContract.ArrivalEntry.TABLE_NAME
                        + "." + BusContract.ArrivalEntry.ROUTE_NAME + " = ?",
                new String[] { "1", routeName },
                BusContract.StopEntry.TABLE_NAME + "." + BusContract.StopEntry.STOP_ID);
    default:
        Log.d(TAG, "Not valid id: " + id);
        return null;
    }
}

From source file:com.wattzap.model.GPXReader.java

/**
 * Calculate distance between two points in latitude and longitude taking
 * into account height difference. If you are not interested in height
 * difference pass 0.0. Uses Haversine method as its base.
 * /*from www . ja v  a  2 s  . c  o m*/
 * lat1, lon1 Start point lat2, lon2 End point el1 Start altitude in meters
 * el2 End altitude in meters
 * 
 * @returns Distance in Meters
 */
public static double distance(double lat1, double lat2, double lon1, double lon2, double el1, double el2) {

    final int R = 6371; // Radius of the earth

    Double latDistance = Math.toRadians(lat2 - lat1);
    Double lonDistance = Math.toRadians(lon2 - lon1);
    Double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + Math.cos(Math.toRadians(lat1))
            * Math.cos(Math.toRadians(lat2)) * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2);
    Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
    double distance = R * c * 1000; // convert to meters

    double height = el1 - el2;

    distance = (distance * distance) + (height * height);

    return Math.sqrt(distance);
}

From source file:com.mousebird.maply.MaplyStarModel.java

public void addToViewc(GlobeController inViewC, MaplyBaseController.ThreadMode mode) {
    this.viewC = inViewC;
    this.addedMode = mode;

    //Julian date for position calculation
    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    double jd = getJulianDateDouble(cal.getTimeInMillis());
    double siderealTime = Greenwich_Mean_Sidereal_Deg(jd);

    //Really simple shader
    Shader shader = new Shader("Star Shader", vertexShaderTriPoint,
            (image != null ? fragmentShaderTexTriPoint : fragmentShaderTriPoint), viewC);
    shader.setUniform("u_radius", 6.0);
    viewC.addShaderProgram(shader, "Star Shader");

    long shaderID = viewC.getScene().getProgramIDBySceneName("Star Shader");

    //Set up a simple particle system (that doesn't move)
    particleSystem = new ParticleSystem("Stars");
    particleSystem.setParticleSystemType(ParticleSystem.STATE.ParticleSystemPoint);
    particleSystem.setLifetime(1e20);/* w  w w  . j a v a2 s. c o  m*/
    particleSystem.setTotalParticles(stars.size());
    particleSystem.setBatchSize(stars.size());
    particleSystem.setShaderID(shaderID);

    if (image != null) {
        particleSystem.addTexture(image);
    }

    particleSystem.addParticleSystemAttribute("a_position",
            ParticleSystemAttribute.MaplyShaderAttrType.MAPLY_SHADER_ATTR_TYPE_FLOAT3);
    particleSystem.addParticleSystemAttribute("a_size",
            ParticleSystemAttribute.MaplyShaderAttrType.MAPLY_SHADER_ATTR_TYPE_FLOAT);

    particleSystemObj = viewC.addParticleSystem(particleSystem, addedMode);

    //Data arrays for particles
    //We'll clear them out in case we don't fill them out completely
    float[] posData = new float[stars.size() * 3];
    float[] sizeData = new float[stars.size()];

    for (int i = 0; i < stars.size(); i++) {
        SingleStar singleStar = stars.get(i);

        //Convert the start from equatorial to useable lon/lat
        //Note: Should check this math
        double starLon = Math.toRadians(singleStar.ra - 15 * siderealTime);
        double starLat = Math.toRadians(singleStar.dec);

        double z = Math.sin(starLat);
        double rad = Math.sqrt(1.0 - z * z);
        Point3d pt = new Point3d(rad * Math.cos(starLon), rad * Math.sin(starLon), z);

        posData[i * 3] = (float) pt.getX();
        posData[i * 3 + 1] = (float) pt.getY();
        posData[i * 3 + 2] = (float) pt.getZ();
        float mag = (float) (6.0 - singleStar.mag);
        if (mag < 0.0)
            mag = (float) 0.0;
        sizeData[i] = mag;
    }

    //Set up the particle batch
    ParticleBatch batch = new ParticleBatch(particleSystem);
    batch.addAttribute("a_position", posData);
    batch.addAttribute("a_size", sizeData);
    viewC.addParticleBatch(batch, addedMode);

}

From source file:PaintUtils.java

private static Point2D[] adjustPoints(Point2D[] pts, int width, int height) {
    Point2D start = pts[0];/*from  w  ww  .ja v a 2 s .  co  m*/
    Point2D end = pts[1];

    double angle = calcAngle(start, end);
    double a2 = Math.toDegrees(angle);
    double e = 1;

    // if it is near 0 degrees
    if (Math.abs(angle) < Math.toRadians(e) || Math.abs(angle) > Math.toRadians(360 - e)) {
        start = new Point2D.Float(0, 0);
        end = new Point2D.Float(width, 0);
    }

    // near 45
    if (isNear(a2, 45, e)) {
        start = new Point2D.Float(0, 0);
        end = new Point2D.Float(width, height);
    }

    // near 90
    if (isNear(a2, 90, e)) {
        start = new Point2D.Float(0, 0);
        end = new Point2D.Float(0, height);
    }

    // near 135
    if (isNear(a2, 135, e)) {
        start = new Point2D.Float(width, 0);
        end = new Point2D.Float(0, height);
    }

    // near 180
    if (isNear(a2, 180, e)) {
        start = new Point2D.Float(width, 0);
        end = new Point2D.Float(0, 0);
    }

    // near 225
    if (isNear(a2, 225, e)) {
        start = new Point2D.Float(width, height);
        end = new Point2D.Float(0, 0);
    }

    // near 270
    if (isNear(a2, 270, e)) {
        start = new Point2D.Float(0, height);
        end = new Point2D.Float(0, 0);
    }

    // near 315
    if (isNear(a2, 315, e)) {
        start = new Point2D.Float(0, height);
        end = new Point2D.Float(width, 0);
    }

    return new Point2D[] { start, end };
}

From source file:uk.ac.diamond.scisoft.ncd.actors.forkjoin.test.NcdProcessingModelTest.java

@BeforeClass
public static void setUp() throws Exception {

    // This is required for ROIParameter class to work      
    ServiceManager.setService(IPersistenceService.class, PersistenceServiceCreator.createPersistenceService());

    testScratchDirectoryName = TestUtils
            .generateDirectorynameFromClassname(NcdProcessingModelTest.class.getCanonicalName());
    TestUtils.makeScratchDirectory(testScratchDirectoryName);
    filename = testScratchDirectoryName + "ncd_processing_test.nxs";
    bgFilename = testScratchDirectoryName + "ncd_bg_test.nxs";

    String testFileFolder = TestUtils.getGDALargeTestFilesLocation();
    if (testFileFolder == null) {
        Assert.fail("TestUtils.getGDALargeTestFilesLocation() returned null - test aborted");
    }/*  www  . j av  a 2  s  .c o m*/

    Path bgPath = new Path(testFileFolder + "NCDReductionTest/i22-24132.nxs");
    Path drPath = new Path(testFileFolder + "NCDReductionTest/i22-24125.nxs");
    Path inputPath = new Path(testFileFolder + "NCDReductionTest/i22-24139.nxs");

    FileInputStream inFile = new FileInputStream(inputPath.toOSString());
    FileOutputStream outFile = new FileOutputStream(filename);

    IOUtils.copy(inFile, outFile);

    inFile = new FileInputStream(bgPath.toOSString());
    outFile = new FileOutputStream(bgFilename);

    IOUtils.copy(inFile, outFile);

    drFile = drPath.toOSString();

    flags = new NcdReductionFlags();
    flags.setEnableNormalisation(true);
    flags.setEnableBackground(true);
    flags.setEnableDetectorResponse(true);
    flags.setEnableSector(true);
    flags.setEnableRadial(true);
    flags.setEnableAzimuthal(true);
    flags.setEnableFastintegration(false);
    flags.setEnableInvariant(true);
    flags.setEnableAverage(true);
    flags.setEnableSaxs(true);
    flags.setEnableWaxs(false);
    flags.setEnableLogLogPlot(true);
    flags.setEnableGuinierPlot(true);
    flags.setEnablePorodPlot(true);
    flags.setEnableKratkyPlot(true);
    flags.setEnableZimmPlot(true);
    flags.setEnableDebyeBuechePlot(true);

    DiffractionDetector ncdDetector = new DiffractionDetector();
    ncdDetector.setDetectorName(detector);
    ncdDetector.setxPixelSize(pxSaxs);
    ncdDetector.setyPixelSize(pxSaxs);

    intSector = new SectorROI(262.0, 11.0, 20.0, 500.0, Math.toRadians(60.0), Math.toRadians(120.0));
    intPoints = intSector.getIntRadius(1) - intSector.getIntRadius(0);
    azPoints = (int) Math.ceil((intSector.getAngle(1) - intSector.getAngle(0)) * intSector.getRadius(1));
    framesSec = new long[] { 1, lastFrame - firstFrame + 1, intPoints };
    framesSecAz = new long[] { 1, lastFrame - firstFrame + 1, azPoints };
    framesInv = new long[] { 1, lastFrame - firstFrame + 1 };
    framesAve = new long[] { 1, 1, intPoints };
    framesBg = new long[] { 1, 1, intPoints };

    testClass = new NcdProcessingModel();
    testClass.setBgFile(bgFilename);
    testClass.setDrFile(drFile);
    testClass.setAbsScaling(absScaling);
    testClass.setBgDetector(detectorBg);
    testClass.setBgScaling(bgScaling);
    testClass.setFirstFrame(firstFrame);
    testClass.setLastFrame(lastFrame);
    testClass.setCalibration(calibration);
    testClass.setNormChannel(normChannel);
    testClass.setCrb(crb);
    testClass.setEnableMask(enableMask);
    testClass.setFlags(flags);
    testClass.setIntSector(intSector);
    testClass.setMask(mask);
    testClass.setNcdDetector(ncdDetector);
    testClass.setSaxsAnalysisStatsParameters(saxsAnalysisStatParams);

    testbgClass = new NcdProcessingModel();
    testbgClass.setDrFile(drFile);
    testbgClass.setAbsScaling(absScaling);
    testbgClass.setFirstFrame(bgFirstFrame);
    testbgClass.setLastFrame(bgLastFrame);
    testbgClass.setFrameSelection(bgFrameSelection);
    testbgClass.setCalibration(calibration);
    testbgClass.setNormChannel(normChannel);
    testbgClass.setCrb(crb);
    testbgClass.setEnableMask(enableMask);
    testbgClass.setSaxsAnalysisStatsParameters(saxsAnalysisStatParams);

    flags.setEnableBackground(false);
    flags.setEnableInvariant(false);
    testbgClass.setFlags(flags);

    testbgClass.setIntSector(intSector);
    testbgClass.setMask(mask);
    testbgClass.setNcdDetector(ncdDetector);

    DataSliceIdentifiers dr_id = readDataId(drFile, detector, "data", null)[0];
    SliceSettings drSlice = new SliceSettings(drFrames, 1, 1);
    int[] start = new int[] { 0, 0, 0, 0 };
    drSlice.setStart(start);
    dr = NcdNexusUtils.sliceInputData(drSlice, dr_id);

    testbgClass.execute(bgFilename, null);
    testClass.execute(filename, null);
}

From source file:RadialLayout.java

/**
 * This is called when the panel is first displayed, and every time its size
 * changes./*  w w  w  .ja v  a 2 s.  c om*/
 * Note: You CAN'T assume preferredLayoutSize or minimumLayoutSize will be
 * called -- in the case of applets, at least, they probably won't be.
 *
 * @param  parent  the parent.
 * @see LayoutManager
 */
public void layoutContainer(final Container parent) {
    final Insets insets = parent.getInsets();
    final int maxWidth = parent.getSize().width - (insets.left + insets.right);
    final int maxHeight = parent.getSize().height - (insets.top + insets.bottom);
    final int nComps = parent.getComponentCount();
    int x = 0;
    int y = 0;

    // Go through the components' sizes, if neither preferredLayoutSize nor
    // minimumLayoutSize has been called.
    if (this.sizeUnknown) {
        setSizes(parent);
    }

    if (nComps < 2) {
        final Component c = parent.getComponent(0);
        if (c.isVisible()) {
            final Dimension d = c.getPreferredSize();
            c.setBounds(x, y, d.width, d.height);
        }
    } else {
        double radialCurrent = Math.toRadians(90);
        final double radialIncrement = 2 * Math.PI / nComps;
        final int midX = maxWidth / 2;
        final int midY = maxHeight / 2;
        final int a = midX - this.maxCompWidth;
        final int b = midY - this.maxCompHeight;
        for (int i = 0; i < nComps; i++) {
            final Component c = parent.getComponent(i);
            if (c.isVisible()) {
                final Dimension d = c.getPreferredSize();
                x = (int) (midX - (a * Math.cos(radialCurrent)) - (d.getWidth() / 2) + insets.left);
                y = (int) (midY - (b * Math.sin(radialCurrent)) - (d.getHeight() / 2) + insets.top);

                // Set the component's size and position.
                c.setBounds(x, y, d.width, d.height);
            }
            radialCurrent += radialIncrement;
        }
    }
}