-/* $Id$
-
-This file is part of R²C²
-Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
#include <cmath>
#include "catalogue.h"
#include "driver.h"
front_sensor(0),
back_sensor(0)
{
- axles.assign(type.get_axles().begin(), type.get_axles().end());
+ axles.assign(type.get_fixed_axles().begin(), type.get_fixed_axles().end());
bogies.assign(type.get_bogies().begin(), type.get_bogies().end());
rods.assign(type.get_rods().begin(), type.get_rods().end());
propagate_position();
}
+const Vehicle::Axle &Vehicle::get_fixed_axle(unsigned i) const
+{
+ if(i>=axles.size())
+ throw InvalidParameterValue("Axle index out of range");
+ return axles[i];
+}
+
const Vehicle::Bogie &Vehicle::get_bogie(unsigned i) const
{
if(i>=bogies.size())
return bogies[i];
}
-const Vehicle::Axle &Vehicle::get_axle(unsigned i) const
-{
- if(i>=axles.size())
- throw InvalidParameterValue("Axle index out of range");
- return axles[i];
-}
-
const Vehicle::Axle &Vehicle::get_bogie_axle(unsigned i, unsigned j) const
{
if(i>=bogies.size())
i->position = i->type->pivot_point;
else if(i->type->pivot==VehicleType::Rod::AXLE)
{
- const Axle &axle = get_axle(i->type->pivot_index);
+ const Axle &axle = get_fixed_axle(i->type->pivot_index);
float c = cos(axle.angle);
float s = sin(axle.angle);
const Vector &pp = i->type->pivot_point;