0

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;
      }
    }
2
Contributors
2
Replies
9
Views
2 Years
Discussion Span
Last Post by stultuske
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.