]> git.tdb.fi Git - r2c2.git/commitdiff
Correct TrackAttachment entry endpoint
authorMikko Rasa <tdb@tdb.fi>
Sun, 15 Feb 2015 08:40:37 +0000 (10:40 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 15 Feb 2015 15:48:48 +0000 (17:48 +0200)
Since endpoint direction points outwards from the endpoint, we want to
find one that's as close to opposite to the TrackAttachment's direction
as possible.

source/libr2c2/trackattachment.cpp

index 024166820dc8adcac64e2a2be16e710b19ed681b..9e3d244056602dd33684daddafe6ff799d21faa2 100644 (file)
@@ -69,7 +69,7 @@ void TrackAttachment::attach_to_closest(float limit)
                for(unsigned i=0; i<nsn; ++i)
                {
                        Snap sn = trk->get_snap_node(i);
-                       Angle adiff = abs(wrap_balanced(sn.rotation-rotation));
+                       Angle adiff = abs(wrap_balanced(sn.rotation+Angle::half_turn()-rotation));
                        if(adiff<Angle::quarter_turn())
                        {
                                TrackIter iter(trk, i);