Anyone who can help,
I need to display a circle as a 'compass rose' an allow a 'click' on it to record a bearing.
I have searched the forums for 'circle' and 'compass', but cannot find anything relevant that will give me a start in the right direction.
Please can anyone help by showing me a basic idea to draw a circle and label the basic compass points around it?
Many thanks,
Allen
Compass Rose
Re: Compass Rose
You can draw a smooth circle using the GDI+ Library.
Alternatively, here's a quick self-contained approach:
Change the second line to the following to make it more of a solid circle (changes degree increment from 5 to 1):
Alternatively, here's a quick self-contained approach:
Code: Select all
Gui, Add, Progress, BackgroundBlack x130 y130 w3 h3
Points := PointsOnCircle(100, 5, 130, 30)
for Each, P in Points
Gui, Add, Progress, % "BackgroundBlack x" P.x " y" P.y " w3 h3"
Gui, Font, s12
Gui, Add, Text, x125 y5, N
Gui, Add, Text, xp y235, S
Gui, Add, Text, x10 y120, W
Gui, Add, Text, x240 yp, E
Gui, Show
return
PointsOnCircle(r := 200, degInc := 5, topX := 100, topY := 0)
{
static radPerDeg := 3.14159265359 / 180
points := []
angle := 0
cx := 0
cy := r
loop, % 360 / degInc
{
angle += degInc * radPerDeg
points.Push({x: cx + r * Sin(angle) + topX, y: cy - r * Cos(angle) + topY})
}
return points
}
GuiClose:
ExitApp
Code: Select all
Points := PointsOnCircle(100, 1, 130, 30)
Re: Compass Rose
This version has an inner "circle" marking every 45 degrees:
Code: Select all
Gui, Add, Progress, BackgroundRed x130 y130 w3 h3
Points := PointsOnCircle(100, 1, 130, 30)
for Each, P in Points
Gui, Add, Progress, % "BackgroundBlack x" P.x " y" P.y " w3 h3"
Points := PointsOnCircle(90, 45, 130, 40)
for Each, P in Points
Gui, Add, Progress, % "BackgroundRed x" P.x " y" P.y " w3 h3"
Gui, Font, s12 cBlue
Gui, Add, Text, x125 y5, N
Gui, Add, Text, xp y235, S
Gui, Add, Text, x10 y120, W
Gui, Add, Text, x240 yp, E
Gui, Show
return
PointsOnCircle(r := 200, degInc := 5, topX := 100, topY := 0)
{
static radPerDeg := 3.14159265359 / 180
points := []
angle := 0
cx := 0
cy := r
loop, % 360 / degInc
{
angle += degInc * radPerDeg
points.Push({x: cx + r * Sin(angle) + topX, y: cy - r * Cos(angle) + topY})
}
return points
}
GuiClose:
ExitApp
Re: Compass Rose
Hi boiler,
Many thanks - that has pointed me in the right direction, and given me a basis on which to work.
I appreciate your help,
Yours sincerely,
Allen
Many thanks - that has pointed me in the right direction, and given me a basis on which to work.
I appreciate your help,
Yours sincerely,
Allen
Who is online
Users browsing this forum: SimmoF and 233 guests