X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftracktype.cpp;h=23c636c6d1cd1689d4a809c7fb23f3929f27c6b7;hb=4086edbfae9a04da491cdb349a3bef6af5c132d9;hp=c7a6aef7ba70fa85bac12a2ac2c1ff1738cc6a6e;hpb=621c5c938d70ba0d155e0eda91a708db0a52c0dc;p=r2c2.git diff --git a/source/libr2c2/tracktype.cpp b/source/libr2c2/tracktype.cpp index c7a6aef..23c636c 100644 --- a/source/libr2c2/tracktype.cpp +++ b/source/libr2c2/tracktype.cpp @@ -113,6 +113,25 @@ TrackPoint TrackType::get_point(unsigned epi, unsigned path, float d) const } } +TrackPoint TrackType::get_nearest_point(const Vector &p) const +{ + TrackPoint result; + float dist = -1; + + for(vector::const_iterator i=parts.begin(); i!=parts.end(); ++i) + { + TrackPoint n = i->get_nearest_point(p); + float d = distance(n.pos, p); + if(d::const_iterator i=parts.begin(); i!=parts.end(); ++i) @@ -173,7 +192,7 @@ TrackType::Endpoint::Endpoint(float x, float y, float d, unsigned p): TrackType::Loader::Loader(TrackType &t): - Msp::DataFile::BasicLoader(t), + Msp::DataFile::ObjectLoader(t), state_bits_set(false) { add("autofit_preference", &TrackType::autofit_preference);