coure2011
coure2011

Reputation: 42404

drawing arc points

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?

Upvotes: 1

Views: 4236

Answers (2)

Pete Kirkham
Pete Kirkham

Reputation: 49311

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.

Upvotes: 0

Ted Hopp
Ted Hopp

Reputation: 234795

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.

Upvotes: 2

Related Questions