Hello out there,
I would like to draw Arcs
( Like the ones you see when you call
Arc( x, y, stAngle, endAngle, Radius ),
but i want to draw the Arc pixel by pixel
Are there some wizards who can help me out ?
And please don't misunderstand me, i know how to put a pixel on the screen, i'm interested in the formula to calculate the x and y values which are needed to create a Arc
Tnx in advance
Comments
X and Y are the center point.
for Angle := start_angle to end_angle do
NewX = X + (radius * cos(Angle))
NewY = Y - (radius * sin(Angle))
end;
*The reason I do Y-(...) is because of screen coordinate, Y value increase as you go down, opposite of the cartesian coordinate system.
I guess you can do something like that, but I just wrote that here, so I don't have a chance to test it.
Good Luck
Phase_Zero
that can do the job with a few modifications, but i would like to draw the Arc with an algorithm. I've found some stuff about Bresenhams Midpoint Algorithm which can be used to draw a Circle.
I don't know how to modify this to draw an Arc the same way.
I've been surfing for about 10 hours and didn't find a way, so maybe someone else with a fresh look at the problem has an idea ?
Tnx in advance
i still don't know why you can't settle for the standard ARC, perhaps you want to put different colors in between..
anyway, try putting pixels from an X to an X and as for the Y's you increase or decrease when the index reaches certain numbers like if it divides by 2 with no remainder or something, i don't know exactly how it would look but play with it..
or from a certain Y to a certain Y and change the X values along the way in a similar fashion.
i do think that cos and sin would be the best way to go about this but maybe you can find a new formula that works for these things..
the important thing is to keep trying..
//Noam
Phase Zero