Open Rasbats opened 9 months ago
Revised code is here:
tactics_pi.cpp.txt
The important bit starts at line 1415.
The GCIntersectSegment function does the job of finding the intersect. There is probably a lot of extra code that could be removed from the if(goAhead)..else
but I am reluctant to do that without peer review.
Results are shown here:
Missed another intersection check later in the file. Updated _tacticspi.cpp.txt here: tactics_pi.cpp.txt
https://www.codeguru.com/cplusplus/geographic-distance-and-azimuth-calculations/ Provided the code to make the intersection happen.
Mike, Thanks, very much!!! I will try to make this change in both tactics and dashboard_tactics on my repo. Very nice testing procedure with shipdriver! Glad you found that.
@Rasbats Mike, I tried comparing your tactics_pi.cpp.txt to the one in my repo and it appears that the entire file is different. You say that the change starts at line 1415. Since I can't determine easily, what the isolated change is, can you advise where it ends? Or perhaps which function? Or maybe there is a github source that I could do a dif or something?
I am reluctant to just copy over the entire original file.
I found this repo and file https://github.com/Rasbats/tactics_pi/blob/master/src/tactics_pi.cpp This has been around for quite awhile in your repo and work has been done on it. Why not let me know about it?
Sorry, the line is 1206 in your repo mnt151-frontend2:
wxRealPoint intersection_pos;
intersection_pos = GetLineIntersection(c_end, c_end2, m_end, m_end2);
The function GetLineIntersection is the problem. Look at lines starting around 1447 in the .txt file above and you will find the code changes needed. GetLineIntersection is replaced by GCIntersectSegment et al.
Mike, sorry I was not clear, I am using rgleason/tactics_pi/tactics_pi.cpp and am now comparing to https://github.com/Rasbats/tactics_pi/blob/master/src/tactics_pi.cpp.
There are a lot of differences, but it is a better comparison. I will try to find GetLineIntersection .
I notice that your version appears to be based upon an incomplete development and Tom and Petri had other commits afterwards, from what I can see. How would I test for this problem in my version? I think I should do that first, so I don't screw things up needlessly.
Here are the find getlineintersection in my version of tactics_pi.cpp
Search "getlineintersection" (3 hits in 1 file of 1 searched) [Normal]
C:\Users\fcgle\source\tactics_pi\src\tactics_pi.cpp (3 hits)
Line 998: wxRealPoint GetLineIntersection(wxRealPoint line1point1, wxRealPoint line1point2, wxRealPoint line2point1, wxRealPoint line2point2)
Line 1349: intersection_pos = GetLineIntersection(c_end, c_end2, m_end, m_end2);
Line 1457: pIntersection_pos = GetLineIntersection(pc_end, pc_end2, pm_end, pm_end2);
Here are the getlineintersection in your version of tactics_pi.cpp (direct from your repo)
Search "getlineintersection" (1 hit in 1 file of 1 searched) [Normal]
C:\Users\fcgle\Downloads\tactics_pi.cpp (1 hit)
Line 777: wxRealPoint GetLineIntersection(wxRealPoint line1point1, wxRealPoint line1point2, wxRealPoint line2point1, wxRealPoint line2point2)
However I find not GCIntersectSegment In this file!
Lets take this to the bug in tactics_pi: https://github.com/rgleason/tactics_pi/issues/48
Installation checklist (change to [X] when sure)
I have installed the software for which I am reporting the issues from:
[X] Your own fork and build Link
[X] Issue reported in CF DashT thread
Specifications
Expected Behavior
Mark laylines should appear for the area where the vessel is being sailed
Current Behavior
Mark laylines appear for east longitudes, north latitude. They do not appear for west longitude, north latitude.
Logic is not correct in the code for the intersection of lines.
Possible Solution
Use spherical trig to solve the intersection problem. Code for solving the problem will be posted here. Unwilling to make a PR as review by Thomas_R and/or Canne is needed.
Steps/Code to Reproduce the Problem
See: https://www.cruisersforum.com/forums/f134/dashboard-tactics-dash-t-226601-16.html#post3862050