-int Track::traverse(unsigned i, unsigned route) const
-{
- const vector<Endpoint> &eps = type.get_endpoints();
- if(i>=eps.size())
- throw InvalidParameterValue("Endpoint index out of range");
-
- const Endpoint &ep = eps[i];
-
- if(ep.routes&(1<<route))
- {
- // Find the other endpoint for this route
- for(unsigned j=0; j<eps.size(); ++j)
- if((eps[j].routes&(1<<route)) && j!=i)
- return j;
- }
- else
- {
- // Find an endpoint that's connected to this one and has the requested route
- for(unsigned j=0; j<eps.size(); ++j)
- if((eps[j].routes&(1<<route)) && (eps[j].routes&ep.routes))
- return j;
- }
-
- return -1;
-}
-
-Point Track::get_point(unsigned epi, unsigned route, float d) const