void VehiclePlacement::place(const TrackOffsetIter &p, Anchor a)
{
+ if(!p)
+ return unplace();
+
float anchor = get_anchor_position(a);
for(vector<Axle>::iterator i=axles.begin(); i!=axles.end(); ++i)
OrientedPoint result;
result.position = front*(1-ratio)+back*ratio;
result.rotation = Geometry::atan2<float>(front.y-back.y, front.x-back.x);
- result.tilt = Geometry::atan2<float>(front.z-back.z, LinAl::Vector<float, 2>(front-back).norm());
+ result.tilt = Geometry::atan2<float>(front.z-back.z, (front-back).slice<2>(0).norm());
return result;
}
float span = distance(p1, p2);
float adjust = target-span;
- /* If the adjustment is larger than the last one, we've hit a gap or
+ /* If the adjustment is not smaller than the last one, we've hit a gap or
other oddity in the track. Terminate to avoid an infinite loop. */
- if(last>0 && abs(adjust)>last)
+ if(last>0 && abs(adjust)>=last)
return 0;
if(abs(adjust)*10000<target)