1
votes

Can someone provide me an algorithm to draw points on arc? I know the start-point, end-point and radius. I need to show points on the arc made by this information(start-point, end-point and radius).

See the image for more details enter image description here

I have Start-Point (x,y), End-Point(a,b). I have to calculate equally distance 5 points on arc. Is it possible?

2
What kind of arc are we talking about here? Assuming you're talking about chords, it's impossible to even draw out the chord given any arbitrary start/end point and a radius. For example, it's impossible to have a chord with a start point of (0, 0), an end point of (100, 100) and a radius of 1. Usually chords drawings are usually specified in terms of the circle center, radius, and begin/end degree measurements.In silico

2 Answers

2
votes

The standard algorithm for this is the Midpoint circle algorithm (sometimes called Breshenham's circle algorithm).

Note that your arc specification is incomplete. There are generally two arcs of the same radius joining two given points, one for the center on each side of the line joining the points. Also, as @In silico points out, the radius can be no smaller than half the distance between the points.

0
votes

The means of specifying an arc is similar to that used in SVG, which has some detailed implementation notes which are too long to copy here. For circular arcs, the x and y radii are equal so the x axis angle is not important. As Ted Hopp noted, you need a flag to indicate which direction the arc is drawn in ( in SVG called large-arc-flag ).

Once you have the centre and angles of start and end of the arc, divide the angle into six and use the sin/cos of this angle to plot the five intermediate points.