I want to get all the vertices from an ARC. I have all the data (for ex : start point, end point, start angle, end angle, radius) which will used to draw an arc but my need is I have to generate all the vertices from the arc data.

I have already tried with one or two algorithm but I failed to get the exact vertices from an arc data.

I used Bresenham's algorithm but I failed.

Right now I am using below code but its not working ..

    Coordinate startPoint = new Coordinate(10, 15);

    double x = radius;
    double y = 0;
    double radiusError = 1-x;
    double x0 = startPoint.getX();
    double y0 = startPoint.getY();

    while(x >= y) {
      coordinates.add(new Coordinate( x + x0,  y + y0));
      coordinates.add(new Coordinate( y + x0,  x + y0));
      coordinates.add(new Coordinate(-x + x0,  y + y0));
      coordinates.add(new Coordinate(-y + x0,  x + y0));
      coordinates.add(new Coordinate(-x + x0, -y + y0));
      coordinates.add(new Coordinate(-y + x0, -x + y0));
      coordinates.add(new Coordinate( x + x0, -y + y0));
      coordinates.add(new Coordinate( y + x0, -x + y0));
      y++;
      if (radiusError<0) {
        radiusError += 2 * y + 1;
      }
      else {
        x--;
        radiusError += 2 * (y - x) + 1;
      }
    }

Recommended Answers

All 2 Replies

its not working

do you think you could be a bit more specific?

Farasat007: And your point is ......... ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.