From: Mikko Rasa Date: Sun, 7 Jul 2013 21:23:32 +0000 (+0300) Subject: Keep TrackAttachment offset within allowed limits X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=1ba514de333b7c3f990201a60bd1b18a62c55133;p=r2c2.git Keep TrackAttachment offset within allowed limits --- diff --git a/source/libr2c2/trackattachment.cpp b/source/libr2c2/trackattachment.cpp index 3d28651..29521fd 100644 --- a/source/libr2c2/trackattachment.cpp +++ b/source/libr2c2/trackattachment.cpp @@ -81,7 +81,7 @@ float TrackAttachment::find_offset(const TrackIter &trk, const Vector &point) Vector epp = trk->get_snap_node(trk.entry()).position; float dist = distance(epp, point); - float offs = dist; + float offs = min(dist, trk->get_type().get_path_length(0)); while(1) { TrackPoint tp = trk->get_point(trk.entry(), offs);