* Test1 angle of arc <=90 PrintCoords(60,30,100) PrintCoords(150,120,100) PrintCoords(240,210,100) PrintCoords(330,300,100) * Test 2 angle of arc <180 PrintCoords(150,30,100) PrintCoords(240,120,100) PrintCoords(330,210,100) PrintCoords(420,300,100) * Test 3 angle of arc <270 PrintCoords(240,30,100) PrintCoords(330,120,100) PrintCoords(420,210,100) PrintCoords(510,300,100) * Test 4 angle of arc <360 PrintCoords(330,30,100) PrintCoords(420,120,100) PrintCoords(510,210,100) PrintCoords(600,300,100) * Test 5 angle of arc =360 PrintCoords(360,0,100) * Params are the starting and ending angle in degrees, * and the radius of the larger circle. * The angle of the arc can be anything * Angle 1 must be > Angle 2 FUNCTION PrintCoords( tnAngle1, tnAngle2, tnRadius ) * Convert agles to radians tnRAngle1 = DTOR(tnAngle1) tnRAngle2 = DTOR(tnAngle2) * Divide the arc into three equal sectors lnArcInc = ABS((tnRAngle1 - tnRAngle2)/3) * Draw tangents at centre points of each sector * Calc distance from 0,0 to the vertices formed by tangents l = tnRadius/COS(lnArcInc/2) * Calc coordinates of vertices DIMENSION aCoords[6,2] aCoords = 0 FOR t = 0 TO 3 aCoords[t+2,1] = l*COS(tnRAngle1-t*lnArcInc) aCoords[t+2,2] = -l*SIN(tnRAngle1-t*lnArcInc) ENDFOR * Print Coords CLEAR FOR ii = 1 TO 6 @ 17 + ii, 3 SAY "(" + TRANSFORM(aCoords[ii,1]) + "," + TRANSFORM(aCoords[ii,2]) + ")" ENDFOR * Sorry but I'm the visual sort, I have to draw it. =ShowCoords( tnAngle1, tnAngle2, tnRadius) ENDFUNC FUNCTION ShowCoords( tnAngle1, tnAngle2, tnRadius) lnExtra = 50 lnOffSetX = tnRadius + lnExtra + 30 lnOffSetY = lnOffSetX * Draw axes _SCREEN.Line(lnOffSetX - tnRadius - lnExtra,; lnOffSetY ,; lnOffSetX + tnRadius + lnExtra,; lnOffSetY) _SCREEN.Line(lnOffSetX ,; lnOffSetY - tnRadius - lnExtra,; lnOffSetX ,; lnOffSetY + tnRadius + lnExtra) * Draw arcs lnAngle = DTOR(tnAngle1) lnArcIncrement = (DTOR(tnAngle1) - DTOR(tnAngle2))/100 FOR t = 1 TO 100 nXCoord1 = lnOffSetX + tnRadius*COS(lnAngle) nYCoord1 = lnOffSetY - tnRadius*SIN(lnAngle) lnAngle = lnAngle - lnArcIncrement nXCoord2 = lnOffSetX + tnRadius*COS(lnAngle) nYCoord2 = lnOffSetY - tnRadius*SIN(lnAngle) _SCREEN.Line(nXCoord1, nYCoord1, nXCoord2, nYCoord2) ENDFOR * Draw enclosing shape _SCREEN.ForeColor=255 lnSteps = ALEN(aCoords,1) - 1 FOR t =1 TO lnSteps _SCREEN.Line(lnOffSetX+aCoords[t,1] , lnOffSetY+aCoords[t,2] ,; lnOffSetX+aCoords[t+1,1], lnOffSetY+aCoords[t+1,2]) ENDFOR _SCREEN.ForeColor=0 WAIT WINDOW ENDFUNC