diff --git a/target_simulator/gui/ppi_display.py b/target_simulator/gui/ppi_display.py index a94032d..f0bc515 100644 --- a/target_simulator/gui/ppi_display.py +++ b/target_simulator/gui/ppi_display.py @@ -172,9 +172,13 @@ class PPIDisplay(ttk.Frame): # 2. Calculate vector displacement in Cartesian from heading # Heading is defined as degrees clockwise from North (0 = North), # so the unit vector in Cartesian (East, North) is (sin(h), cos(h)). - hdg_rad = math.radians(target.current_heading_deg) - dx_nm = vector_len_nm * math.sin(hdg_rad) - dy_nm = vector_len_nm * math.cos(hdg_rad) + # Invert the sign of the heading angle for plotting so the + # drawn heading arrow follows the same angular convention used + # for positions (theta_plot = -azimuth). Using -heading here + # ensures left/right orientation matches the displayed azimuth. + hdg_rad_plot = math.radians(-target.current_heading_deg) + dx_nm = vector_len_nm * math.sin(hdg_rad_plot) + dy_nm = vector_len_nm * math.cos(hdg_rad_plot) # 3. Find end point in Cartesian x_end_nm = x_start_nm + dx_nm