IanMayo / d3sonar

0 stars 0 forks source link

Trouble with data wraparound #13

Closed IanMayo closed 10 years ago

IanMayo commented 10 years ago

One the Angular developers did a trial run of incorporating the sonar control last week. An early problem arose quickly.

A problem is caused by us joining the point lines. Imagine we're showing the bearing to a ship that is just to the West of North (355 degrees). With the current (0-360) bearing axis, as a contact moves from say 355 degrees, through 0 degrees, to 5 degrees, the line will jump all the way across the control. (as it joins 355 to 0 to 5). Worse still, if the contact is roughly to the North of us, the bearing line may constantly jumping across the full width of the plot.

[You can reproduce this problem in this way: if you temporarily change your random number generation to cover the bearing region -20 to 20 degs. Then if a generated point is -ve add 360 to it - this will give data that spans North]

Another issue recorded here represents changing the bearing axis to 180 - 0 - 180. After that change we will get the problem described above if the contact is to the South of us.

I don't know if d3 has functionality to resolve this (I guess it doesn't). I think the only fix for this is to use a scatter plot, rather than a line plot.

I welcome your thoughts.

IanMayo commented 10 years ago

Aah, if we do have to switch to a scatter plot, that "may" lead us to the next "blurry image" steps.

git-ashish commented 10 years ago

Thanks for the elaboration. I think this problem can't be solved when using paths. The solution is indeed using scatter plot as you suggested. Should I go ahead and change this?

IanMayo commented 10 years ago

Yes please - let's switch to scatter. It may be bring a slight loss in performance, but I'll have to handle that in the simulation update rate.

IanMayo commented 10 years ago

Sorted - now that we have moved to scatter plot