2010-12-23 2 views

답변

5
// (cx, cy) is the center of the circle 
// r is the circle radius 
// the smaller the granularity, the better the circle will look 
// to draw only numberOfIterations points, granularity 
// should be 2*pi/numberOfIterations 

for(i=0; i<2*pi; i+=granularity)  
    DrawPoint(cx + r*sin(i), cy + r*cos(i)); 
4

하나는 또한 Midpoint circle algorith라는 Bresenham의 원 알고리즘이다.

직선형 기본 순환 루틴의 문제점은 별칭 효과가 있고 결과적으로 올바르게 보이지 않는 경향이 있다는 것입니다.이 알고리즘은 루프 요구 사항 인 for(;;)에 꼭 맞지는 않지만 더 좋은 근사값을 제공합니다. 여전히 반복적 인 루프.