dir(0),
length(0),
radius(0),
- route(0),
+ path(0),
dead_end(false)
{ }
void TrackPart::collect_endpoints(vector<Endpoint> &eps) const
{
- eps.push_back(Endpoint(pos.x, pos.y, dir+M_PI, 1<<route));
+ eps.push_back(Endpoint(pos.x, pos.y, dir+M_PI, 1<<path));
if(dead_end)
;
else if(radius)
{
- float a=((radius<0) ? -length : length);
- Point p=get_point(length*abs(radius));
- eps.push_back(Endpoint(p.x, p.y, dir+a, 1<<route));
+ float a = ((radius<0) ? -length : length);
+ Point p = get_point(length*abs(radius));
+ eps.push_back(Endpoint(p.x, p.y, dir+a, 1<<path));
}
else
- eps.push_back(Endpoint(pos.x+cos(dir)*length, pos.y+sin(dir)*length, dir, 1<<route));
+ eps.push_back(Endpoint(pos.x+cos(dir)*length, pos.y+sin(dir)*length, dir, 1<<path));
}
Point TrackPart::get_point(float d) const
{
if(radius)
{
- float a=d/radius;
- float c=cos(a);
- float s=sin(a);
- float rx=radius*sin(dir);
- float ry=-radius*cos(dir);
+ float a = d/radius;
+ float c = cos(a);
+ float s = sin(a);
+ float rx = radius*sin(dir);
+ float ry = -radius*cos(dir);
return Point(pos.x+c*rx-s*ry-rx, pos.y+c*ry+s*rx-ry);
}
else
add("start", &Loader::start);
add("length", &TrackPart::length);
add("radius", &TrackPart::radius);
- add("route", &TrackPart::route);
+ add("path", &TrackPart::path);
add("dead_end", &TrackPart::dead_end);
}
{
if(obj.radius)
{
- obj.length*=M_PI/180;
- obj.radius/=1000;
+ obj.length *= M_PI/180;
+ obj.radius /= 1000;
}
else
- obj.length/=1000;
+ obj.length /= 1000;
- obj.pos.x/=1000;
- obj.pos.y/=1000;
- obj.dir*=M_PI/180;
+ obj.pos.x /= 1000;
+ obj.pos.y /= 1000;
+ obj.dir *= M_PI/180;
}
void TrackPart::Loader::start(float x, float y, float d)
{
- obj.pos=Point(x, y);
- obj.dir=d;
+ obj.pos = Point(x, y);
+ obj.dir = d;
}
} // namespace Marklin