'RESIZE:STRETCH
size = 300 'enter size of window
iwidth = size
iheight = size
_TITLE "Compass fix and mod B+ 2019-10-31" 'MODIFIED by ACJACQUES 2019-11-02
CX = iwidth / 2: CY = iheight / 2 'Centre of circle
Radius = size / 3 'Radius
_MOUSESHOW "CROSSHAIR" ' will display a crosshair cursor
ang
= _ATAN2(mY
- CY
, mX
- CX
)
X
= CX
+ Radius
* COS(ang
) Y
= CY
+ Radius
* SIN(ang
) thic CX, CY, X, Y, 3, &HFFFFFF00
'IF ang = 360 THEN ang = 0
IF da
> 359.99 THEN da
= da
- 360
CIRCLE (CX
, CY
), 38, &HFFFFFFFF 'white center circle PAINT (CX
, CY
), &HFFFFFFFF, &HFFFFFFFF 'filling
CIRCLE (CX
, CY
), 37, &HFF000000 'black center circle PAINT (CX
, CY
), &HFF000000, &HFF000000 'filling
CIRCLE (CX
, CY
), Radius
+ 3, &HFFFFFFFF 'external white circle
'LOCATE 10, 10:
'PRINT USING "Angle: ###.##"; da
da
= INT(da
) 'make only integer chrstr$
= STR$(da
) 'convert to string
chrstr$
= RIGHT$("00" + LTRIM$(chrstr$
), 3) 'to include leading zeros _PRINTSTRING (CX
- 12, CY
- 6), chrstr$
' set position relativve graphic screen with offsets to be centered
t2 = thick / 2
x3
= x1
+ t2
* COS(a
+ PD2
) y3
= y1
+ t2
* SIN(a
+ PD2
) x4
= x1
+ t2
* COS(a
- PD2
) y4
= y1
+ t2
* SIN(a
- PD2
) x5
= x2
+ t2
* COS(a
+ PD2
) y5
= y2
+ t2
* SIN(a
+ PD2
) x6
= x2
+ t2
* COS(a
- PD2
) y6
= y2
+ t2
* SIN(a
- PD2
) ftri x6, y6, x4, y4, x3, y3, K
ftri x3, y3, x5, y5, x6, y6, K