I stared at this a dozen times this weekend and it dawned
on me this morning what the problem was. I'm humbled
Thanks Ross C and Stevie G for your help and my brother for
remembering the slope algorithm
on me this morning what the problem was. I'm humbled
Thanks Ross C and Stevie G for your help and my brother for
remembering the slope algorithm
Graphics 640, 480, 32, 2 SetBuffer BackBuffer() x1#=320 y1#=240 r#=100 While Not KeyHit(1) x2# = MouseX() y2# = MouseY() r# = Abs(MouseZ()*3)+rf# q# = Sqr( ((x1 - x2)*(x1 -x2)) + ((y1 - y2)*(y1 - y2))) rf#=q#*.5 x3#=(x1+x2)/2 y3#=(y1+y2)/2 x# = x3 + Sqr(r^2-(q/2)^2)*(y1-y2)/q y# = y3 + Sqr(r^2-(q/2)^2)*(x2-x1)/q angleToStart#=NAngle(ATan2(y1#-y#,x1#-x#)) angleToEnd#=NAngle(ATan2(y2#-y#,x2#-x#)) LockBuffer() If angleToEnd>angletoStart For angle# = angleToStart To angleToEnd Step 0.05 WritePixel x + Cos( angle ) * r , y + Sin( angle ) * r , $FFFFFF plotpath=1 Next Else For angle# = angleToStart To 360 Step 0.05 WritePixel x + Cos( angle ) * r , y + Sin( angle ) * r , $FFFFFF plotpath=0 Next For angle# = 0 To angleToEnd Step 0.05 WritePixel x + Cos( angle ) * r , y + Sin( angle ) * r , $FFFFFF plotpath=0 Next EndIf UnlockBuffer() Oval(x-2,y-2,4,4) Text 10,0,plotpath Text 10,10,x+" "+ y +" radius: " + r Text 10,20,x1 + " " + y1+" Start Angle: "+angletostart Text 10,30,x2+" "+y2+" End Angle: "+angletoend Flip 0 Cls Wend Function NAngle#(angle#) If angle#<0 Then angle#=180+(180+angle#) Return angle# End Function