+TrackPoint TrackType::get_nearest_point(const Vector &p) const
+{
+ TrackPoint result;
+ float dist = -1;
+
+ for(vector<TrackPart>::const_iterator i=parts.begin(); i!=parts.end(); ++i)
+ {
+ TrackPoint n = i->get_nearest_point(p);
+ float d = distance(n.pos, p);
+ if(d<dist || dist<0)
+ {
+ result = n;
+ dist = d;
+ }
+ }
+
+ return result;
+}
+