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: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.
 * /* ww w .j a v  a  2s  .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);//  ww  w.  j ava2  s .co  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:com.thalespf.dip.DeblurringTest.java

private static Complex[] motionBlur(double[] degradation, int width, int height) {
    Complex[] complex = new Complex[width * height];

    double[] temp = new double[2 * width * height];

    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {

            double teta = Math.PI * ((x - width / 2) % width * A + (y - height / 2) % height * B);

            Sinc sinc = new Sinc();

            double real = Math.cos(teta) * sinc.value(teta) * T;
            double imaginary = Math.sin(teta) * sinc.value(teta) * T;

            Complex c = new Complex(real, imaginary);
            Complex cConj = c.conjugate();

            temp[2 * (x + y * width)] = cConj.getReal();
            temp[2 * (x + y * width) + 1] = cConj.getImaginary();
        }//from   w  ww . j  ava2s  .c  o  m
    }

    for (int y = 0; y < height; y++) {
        for (int x = 0; x < width; x++) {
            int xTranslated = (x + width / 2) % width;
            int yTranslated = (y + height / 2) % height;

            double real = temp[2 * (yTranslated * width + xTranslated)];
            double imaginary = temp[2 * (yTranslated * width + xTranslated) + 1];

            degradation[2 * (x + y * width)] = real;
            degradation[2 * (x + y * width) + 1] = imaginary;

            Complex c = new Complex(real, imaginary);
            complex[y * width + x] = c;
        }
    }

    return complex;
}

From source file:com.bolatu.gezkoncsvlogger.GyroOrientation.GyroscopeOrientation.java

/**
 * Calculates a rotation vector from the gyroscope angular speed values.
 * /*ww  w . j  a  va  2s  . c o m*/
 * @param gyroValues
 * @param deltaRotationVector
 * @param timeFactor
 * @see http://developer.android
 *      .com/reference/android/hardware/SensorEvent.html#values
 */
private void getRotationVectorFromGyro() {
    // Calculate the angular speed of the sample
    float magnitude = (float) Math
            .sqrt(Math.pow(vGyroscope[0], 2) + Math.pow(vGyroscope[1], 2) + Math.pow(vGyroscope[2], 2));

    // Normalize the rotation vector if it's big enough to get the axis
    if (magnitude > EPSILON) {
        vGyroscope[0] /= magnitude;
        vGyroscope[1] /= magnitude;
        vGyroscope[2] /= magnitude;
    }

    // Integrate around this axis with the angular speed by the timestep
    // in order to get a delta rotation from this sample over the timestep
    // We will convert this axis-angle representation of the delta rotation
    // into a quaternion before turning it into the rotation matrix.
    float thetaOverTwo = magnitude * dT / 2.0f;
    float sinThetaOverTwo = (float) Math.sin(thetaOverTwo);
    float cosThetaOverTwo = (float) Math.cos(thetaOverTwo);

    deltaVGyroscope[0] = sinThetaOverTwo * vGyroscope[0];
    deltaVGyroscope[1] = sinThetaOverTwo * vGyroscope[1];
    deltaVGyroscope[2] = sinThetaOverTwo * vGyroscope[2];
    deltaVGyroscope[3] = cosThetaOverTwo;

    // Create a new quaternion object base on the latest rotation
    // measurements...
    qGyroscopeDelta = new Quaternion(deltaVGyroscope[3], Arrays.copyOfRange(deltaVGyroscope, 0, 3));

    // Since it is a unit quaternion, we can just multiply the old rotation
    // by the new rotation delta to integrate the rotation.
    qGyroscope = qGyroscope.multiply(qGyroscopeDelta);
}

From source file:jat.core.cm.TwoBodyAPL.java

public double ta_from_t(double t) {

    double M = meanAnomaly(t);
    double ea = solveKepler(M, this.e);

    double sinE = Math.sin(ea);
    double cosE = Math.cos(ea);
    double den = 1.0 - this.e * cosE;
    double sqrome2 = Math.sqrt(1.0 - this.e * this.e);
    double sinv = (sqrome2 * sinE) / den;
    double cosv = (cosE - this.e) / den;

    double ta = Math.atan2(sinv, cosv);
    if (this.ta < 0.0) {
        this.ta = this.ta + 2.0 * Constants.pi;
    }/*from   w w  w.j ava  2s  .  co m*/

    return ta;
}

From source file:BackEnd.E_Spheres_calculation.java

public void priprava(int pocet_stupnov) throws DelaunayError {

    ArrayList<Double> U_real_list = new ArrayList<Double>();
    ArrayList<Double> U_image_list = new ArrayList<Double>();
    ArrayList<Integer> polohy_lan = new ArrayList<Integer>();

    //iteratory//from   www.  ja v a 2s .  c o  m
    int iterator_lan = 0;
    int elementarny_iterator = 0;
    //basic priprava vektorov 
    for (int cl1 = 0; cl1 < rozptie.getRetazovkaList().size(); cl1++) {

        //cyklus bundle   
        for (int cl2 = 0; cl2 < rozptie.getRetazovkaList().get(cl1).getBundle_over(); cl2++) {

            ArrayList<DPoint> R0_vectors_per_lano = new ArrayList<DPoint>(
                    rozptie.getRetazovka(cl1).getRo_vectors()); // nacitam jedno lano a upravim ho podla bundle konstant
            ArrayList<DPoint> R0_mirror_vectors_per_lano = new ArrayList<DPoint>(
                    rozptie.getRetazovka(cl1).getRo_mirror_vectors());
            polohy_lan.add(elementarny_iterator);
            // cyklus 
            for (int cl3 = 0; cl3 < rozptie.getRetazovka(cl1).getRo_vectors().size(); cl3++) {

                //  bundle korektura pre jeden druhy SMER  a korekcia
                double Y = (double) R0_vectors_per_lano.get(cl3).getY()
                        + (double) rozptie.getRetazovkaList().get(cl1).getZY_cor_Bundle()[1][cl2];
                double Z = (double) R0_vectors_per_lano.get(cl3).getZ()
                        + (double) Math.cos(rozptie.getRetazovkaList().get(cl1).getBeta_over())
                                * rozptie.getRetazovkaList().get(cl1).getZY_cor_Bundle()[0][cl2];
                double X = (double) R0_vectors_per_lano.get(cl3).getX()
                        + (double) Math.sin(rozptie.getRetazovkaList().get(cl1).getBeta_over())
                                * rozptie.getRetazovkaList().get(cl1).getZY_cor_Bundle()[0][cl2];
                DPoint R0 = new DPoint(X, Y, Z);

                //mirrorovanie len jedneho rozmeru pozor
                double Ym = (double) R0_mirror_vectors_per_lano.get(cl3).getY()
                        - (double) rozptie.getRetazovkaList().get(cl1).getZY_cor_Bundle()[1][cl2];
                double Zm = (double) R0_mirror_vectors_per_lano.get(cl3).getZ()
                        + (double) Math.cos(rozptie.getRetazovkaList().get(cl1).getBeta_over())
                                * rozptie.getRetazovkaList().get(cl1).getZY_cor_Bundle()[0][cl2];
                double Xm = (double) R0_mirror_vectors_per_lano.get(cl3).getX()
                        + (double) Math.sin(rozptie.getRetazovkaList().get(cl1).getBeta_over())
                                * rozptie.getRetazovkaList().get(cl1).getZY_cor_Bundle()[0][cl2];
                DPoint R0m = new DPoint(Xm, Ym, Zm);

                // nastavy U real a image do separatnych listov podla toho na akom vodi?i je ( tu sa bundle ignoruje )
                U_real_list.add(get_real(rozptie.getRetazovkaList().get(cl1).getU_over(),
                        rozptie.getRetazovkaList().get(cl1).getPhi_over()) / Math.sqrt(3));
                U_real_list.add(get_real(-rozptie.getRetazovkaList().get(cl1).getU_over(),
                        rozptie.getRetazovkaList().get(cl1).getPhi_over()) / Math.sqrt(3)); // add image voltage
                U_image_list.add(get_image(rozptie.getRetazovkaList().get(cl1).getU_over(),
                        rozptie.getRetazovkaList().get(cl1).getPhi_over()) / Math.sqrt(3));
                U_image_list.add(get_image(-rozptie.getRetazovkaList().get(cl1).getU_over(),
                        rozptie.getRetazovkaList().get(cl1).getPhi_over()) / Math.sqrt(3)); // add image voltage
                // nastavy polomery do jedej arraylistu
                this.polomery_lan.add(rozptie.getRetazovkaList().get(cl1).getR_over()); // realn
                this.polomery_lan.add(rozptie.getRetazovkaList().get(cl1).getR_over()); //image
                this.Ri.add(new DPoint(R0)); // add real
                this.Ri.add(new DPoint(R0m)); // add image to the total list

                //    elementarny_iterator = elementarny_iterator + 1;
            }

        }

    }

    //NULTY STUPEN Qi
    double pocitac = 0;
    for (int i = 0; i < Ri.size(); i++) {
        double qi_real = 4 * Math.PI * this.epsi0 * this.epsiR * polomery_lan.get(i) * U_real_list.get(i);
        double qi_image = 4 * Math.PI * this.epsi0 * this.epsiR * polomery_lan.get(i) * U_image_list.get(i);

        this.qi.add(new Complex(qi_real, qi_image));
        pocitac++;
    }
    System.out.println("pocet prvkov krok O =" + pocitac);
    pocitac = 0;

    //druhy stupen Qij
    for (int i = 0; i < Ri.size(); i++) {

        ArrayList<DPoint> R = new ArrayList<DPoint>();
        ArrayList<Complex> q = new ArrayList<Complex>();

        for (int j = 0; j < Ri.size(); j++) {

            if (i == j) {

            } else {

                double distance = get_distance(Ri.get(i), Ri.get(j));
                double distance2 = Math.pow(distance, 2);
                double Ai = polomery_lan.get(i);
                double Ai2 = Math.pow(Ai, 2);
                if (distance < rozptie.getRetazovka(0).getI_over()) {
                    double q_real = -(Ai / distance) * qi.get(j).getReal();
                    double q_image = -(Ai / distance) * qi.get(j).getImaginary();
                    double X = Ri.get(i).getX() - Ai2 * ((Ri.get(i).getX() - Ri.get(j).getX()) / distance2);
                    double Y = Ri.get(i).getY() - Ai2 * ((Ri.get(i).getY() - Ri.get(j).getY()) / distance2);
                    double Z = Ri.get(i).getZ() - Ai2 * ((Ri.get(i).getZ() - Ri.get(j).getZ()) / distance2);
                    DPoint Ri = new DPoint(X, Y, Z);

                    q.add(new Complex(q_real, q_image));
                    R.add(new DPoint(Ri));
                    pocitac++;

                }
            }

        }
        this.qij.add(new ArrayList<Complex>(q));
        this.Rij.add(new ArrayList<DPoint>(R));

    }
    System.out.println("pocet prvkov krok 1 =" + pocitac);
    pocitac = 0;

    //druhy stupen Qij
    for (int i = 0; i < Ri.size(); i++) {

        ArrayList<ArrayList<DPoint>> Rj = new ArrayList<ArrayList<DPoint>>();
        ArrayList<ArrayList<Complex>> qj = new ArrayList<ArrayList<Complex>>();

        for (int j = 0; j < Rij.size(); j++) {

            ArrayList<DPoint> R = new ArrayList<DPoint>();
            ArrayList<Complex> q = new ArrayList<Complex>();

            if (i == j) {

            } else {

                for (int k = 0; k < Rij.get(0).size(); k++) {
                    if (j == k) {

                    } else {
                        double distance = get_distance(Ri.get(i), Rij.get(j).get(k));
                        double distance2 = Math.pow(distance, 2);
                        double Ai = polomery_lan.get(i);
                        double Ai2 = Math.pow(Ai, 2);
                        if (distance < rozptie.getRetazovka(0).getI_over()) {
                            double q_real = -(Ai / distance) * qij.get(j).get(k).getReal();
                            double q_image = -(Ai / distance) * qij.get(j).get(k).getImaginary();

                            double X = Ri.get(i).getX()
                                    - Ai2 * ((Ri.get(i).getX() - Rij.get(j).get(k).getX()) / distance2);
                            double Y = Ri.get(i).getY()
                                    - Ai2 * ((Ri.get(i).getY() - Rij.get(j).get(k).getY()) / distance2);
                            double Z = Ri.get(i).getZ()
                                    - Ai2 * ((Ri.get(i).getZ() - Rij.get(j).get(k).getZ()) / distance2);
                            DPoint Ri = new DPoint(X, Y, Z);

                            q.add(new Complex(q_real, q_image));
                            R.add(new DPoint(Ri));
                            pocitac++;
                        }
                    }
                }
                qj.add(new ArrayList<Complex>(q));
                Rj.add(new ArrayList<DPoint>(R));
            }

        }
        this.qijk.add(new ArrayList<ArrayList<Complex>>(qj));
        this.Rijk.add(new ArrayList<ArrayList<DPoint>>(Rj));

    }
    System.out.println("pocet prvkov krok 2 =" + pocitac);
    pocitac = 0;

    //druhy stupen Qijkl
    for (int i = 0; i < Ri.size(); i++) {

        ArrayList<ArrayList<ArrayList<DPoint>>> Rjk = new ArrayList<ArrayList<ArrayList<DPoint>>>();
        ArrayList<ArrayList<ArrayList<Complex>>> qjk = new ArrayList<ArrayList<ArrayList<Complex>>>();

        for (int j = 0; j < Rijk.size(); j++) {

            ArrayList<ArrayList<DPoint>> Rj = new ArrayList<ArrayList<DPoint>>();
            ArrayList<ArrayList<Complex>> qj = new ArrayList<ArrayList<Complex>>();

            if (i == j) {

            } else {

                for (int k = 0; k < Rijk.get(0).size(); k++) {

                    ArrayList<DPoint> R = new ArrayList<DPoint>();
                    ArrayList<Complex> q = new ArrayList<Complex>();

                    if (j == k) {

                    } else {

                        for (int l = 0; l < Rijk.get(0).get(0).size(); l++) {
                            if (k == l) {

                            } else {
                                double distance = get_distance(Ri.get(i), Rijk.get(j).get(k).get(l));
                                double distance2 = Math.pow(distance, 2);
                                double Ai = polomery_lan.get(i);
                                double Ai2 = Math.pow(Ai, 2);
                                if (distance < rozptie.getRetazovka(0).getI_over()) {
                                    double q_real = -(Ai / distance) * qijk.get(j).get(k).get(l).getReal();
                                    double q_image = -(Ai / distance)
                                            * qijk.get(j).get(k).get(l).getImaginary();

                                    double X = Ri.get(i).getX()
                                            - Ai2 * ((Ri.get(i).getX() - Rijk.get(j).get(k).get(l).getX())
                                                    / distance2);
                                    double Y = Ri.get(i).getY()
                                            - Ai2 * ((Ri.get(i).getY() - Rijk.get(j).get(k).get(l).getY())
                                                    / distance2);
                                    double Z = Ri.get(i).getZ()
                                            - Ai2 * ((Ri.get(i).getZ() - Rijk.get(j).get(k).get(l).getZ())
                                                    / distance2);
                                    DPoint Ri = new DPoint(X, Y, Z);

                                    q.add(new Complex(q_real, q_image));
                                    R.add(new DPoint(Ri));
                                    pocitac++;
                                }
                            }
                        }
                        qj.add(new ArrayList<Complex>(q));
                        Rj.add(new ArrayList<DPoint>(R));
                    }

                }
            }

            qjk.add(new ArrayList<ArrayList<Complex>>(qj));
            Rjk.add(new ArrayList<ArrayList<DPoint>>(Rj));

        }
        this.qijkl.add(new ArrayList<ArrayList<ArrayList<Complex>>>(qjk));
        this.Rijkl.add(new ArrayList<ArrayList<ArrayList<DPoint>>>(Rjk));

    }
    System.out.println("pocet prvkov krok 3 =" + pocitac);
    pocitac = 0;

}

From source file:matteroverdrive.util.RenderUtils.java

public static void drawCircle(double radius, int segments) {
    glBegin(GL_POLYGON);//from w  w w .  ja  v  a 2  s  . co m
    for (int i = 0; i < segments; i++) {
        glVertex3d(Math.sin((i / (double) segments) * Math.PI * 2) * radius,
                Math.cos((i / (double) segments) * Math.PI * 2) * radius, 0);
    }
    glEnd();
}

From source file:rod_design_compute.ShowPanel.java

private void drawBasePoint(Point point, Graphics g) {
    int x = toScreenX(point.X);
    int y = toScreenY(point.Y);

    int lengthTri = 4 * radiusBase;
    int x1 = (int) (x - lengthTri * Math.sin(Math.toRadians(30)));
    int y1 = (int) (y + lengthTri * Math.cos(Math.toRadians(30)));
    int x2 = (int) (x + lengthTri * Math.sin(Math.toRadians(30)));
    int y2 = (int) (y + lengthTri * Math.cos(Math.toRadians(30)));

    g.drawLine(x, y, x1, y1);// www .  ja va2 s. c o  m
    g.drawLine(x, y, x2, y2);
    g.drawLine(x1 - radiusBase, y1, x2 + radiusBase, y2);

    g.drawLine(x1, y1, x1 - radiusBase, y1 + radiusBase);
    g.drawLine(x1 + radiusBase, y1, x1 + radiusBase - radiusBase, y1 + radiusBase);
    g.drawLine(x1 + 2 * radiusBase, y1, x1 + 2 * radiusBase - radiusBase, y1 + radiusBase);
    g.drawLine(x1 + 3 * radiusBase, y1, x1 + 3 * radiusBase - radiusBase, y1 + radiusBase);
    g.drawLine(x1 + 4 * radiusBase, y1, x1 + 4 * radiusBase - radiusBase, y1 + radiusBase);

    g.setColor(Color.white);
    g.fillOval(x - radiusBase, y - radiusBase, radiusBase * 2, radiusBase * 2);
    g.setColor(Color.black);
    g.drawOval(x - radiusBase, y - radiusBase, radiusBase * 2, radiusBase * 2);
}

From source file:it.unibo.alchemist.model.implementations.positions.LatLongPosition.java

@Override
public List<Position> buildBoundingBox(final double range) {
    if (range < 0d) {
        throw new IllegalArgumentException("Negative ranges make no sense.");
    }/* ww  w  . j  a  va 2 s.co m*/
    /*
     *  angular distance in radians on a great circle
     */
    final double radDist = range / EARTH_MEAN_RADIUS_METERS;
    final double radLat = toRadians(getLatitude());
    final double radLon = toRadians(getLongitude());

    double minLat = radLat - radDist;
    double maxLat = radLat + radDist;

    double minLon;
    double maxLon;
    if (minLat > MIN_LAT && maxLat < MAX_LAT) {
        final double deltaLon = asin(Math.sin(radDist) / cos(radLat));
        minLon = radLon - deltaLon;
        if (minLon < MIN_LON) {
            minLon += 2d * Math.PI;
        }
        maxLon = radLon + deltaLon;
        if (maxLon > MAX_LON) {
            maxLon -= 2d * Math.PI;
        }
    } else {
        // a pole is within the distance
        minLat = Math.max(minLat, MIN_LAT);
        maxLat = Math.min(maxLat, MAX_LAT);
        minLon = MIN_LON;
        maxLon = MAX_LON;
    }
    return Lists.newArrayList(new LatLongPosition(toDegrees(minLat), toDegrees(minLon)),
            new LatLongPosition(toDegrees(maxLat), toDegrees(maxLon)));
}

From source file:com.esri.geoevent.solutions.processor.rangefan.RangeFanProcessor.java

private Geometry constructRangeFan(double x, double y, double range, String unit, double bearing,
        double traversal) throws Exception {
    try {//from  w w  w  .  ja  v  a  2 s  .  c o m
        Polygon fan = new Polygon();
        Point center = new Point();
        center.setX(x);
        center.setY(y);

        Point centerProj = (Point) GeometryEngine.project(center, srIn, srBuffer);

        double centerX = centerProj.getX();
        double centerY = centerProj.getY();
        bearing = GeometryUtility.Geo2Arithmetic(bearing);
        double leftAngle = bearing - (traversal / 2);
        double rightAngle = bearing + (traversal / 2);
        int count = (int) Math.round(Math.abs(leftAngle - rightAngle));
        fan.startPath(centerProj);
        UnitConverter uc = new UnitConverter();
        range = uc.Convert(range, unit, srBuffer);
        for (int i = 0; i < count; ++i) {
            double d = Math.toRadians(leftAngle + i);
            double arcX = centerX + (range * Math.cos(d));
            double arcY = centerY + (range * Math.sin(d));
            Point arcPt = new Point(arcX, arcY);
            fan.lineTo(arcPt);
        }
        fan.closeAllPaths();
        return fan;
    } catch (Exception e) {
        LOG.error(e.getMessage());
        throw e;
    }
}