Loading the image etc - no problem.
Plotting the 3 x,y points and overlaying the 2 lines to highlight the angle - no problem
How do i then calculate the angle described by the 2 lines ( math especialy trigonometry is not my strong point )
I know i cold use opencv for this but i want to understand how it's done.
Below is some quick and dirty plotting code - postion the mouse on the window where you wish to start your first line and right click then move to the 2nd and 3rd points and left click.
Code: Select all
Procedure.i PROC_draw(PVAR_sx.i, PVAR_sy.i, PVAR_fx.i, PVAR_fy.i)
StartDrawing(WindowOutput(0))
Line(PVAR_sx, PVAR_sy, PVAR_fx-PVAR_sx, PVAR_fy-PVAR_sy, RGB(255, 0, 0))
StopDrawing()
EndProcedure
If OpenWindow(0, 0, 0, 1200, 900, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
LVAR_ww.i = WindowWidth(0)
LVAR_wh.i = WindowHeight(0)
LVAR_start.i = #False
LVAR_point_count.i = 1
LVAR_sx.i
LVAR_sy.i
LVAR_fx.i
LVAR_fy.i
Repeat
Event = WaitWindowEvent()
Select Event;EventType()
Case #PB_Event_LeftClick
If LVAR_start = #True And LVAR_point_count < 4
LVAR_fx = WindowMouseX(0)
LVAR_fy = WindowMouseY(0)
Debug "Point " + Str(LVAR_point_count) + " - x,y : " + Str(LVAR_fx) + ", " + Str(LVAR_fy)
PROC_draw(LVAR_sx, LVAR_sy, LVAR_fx, LVAR_fy)
If LVAR_point_count = 3
LVAR_start = #False
Else
LVAR_sx = LVAR_fx
LVAR_sy = LVAR_fy
LVAR_point_count + 1
EndIf
EndIf
Case #PB_Event_RightClick
LVAR_point_count = 1
LVAR_start = #True
LVAR_sx = WindowMouseX(0)
LVAR_sy = WindowMouseY(0)
Debug "Point " + Str(LVAR_point_count) + " - x,y : " + Str(LVAR_sx) + ", " + Str(LVAR_sy)
LVAR_point_count + 1
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf