28#define MIN_SCALED_CARRIAGE_LENGTH 5
42 const double geometryScale = scaledLength / totalLength;
50 myUnscale = geometryScale == 1 && laneFactor != 1;
87 const MSLane* backLane = lane;
88 int backFurtherIndex = furtherIndex;
126 while (carriageOffset < 0) {
135 while (carriageBackOffset < 0) {
137 if (prev != backLane) {
160 Position dir = carriage->front - carriage->back;
161 const double carriageLength = dir.
length2D();
162 if (carriageLength > 0.0) {
166 carriage->doorPositions.push_back(carriage->front - dir * doorOffset);
177 Position dir = carriage->front - carriage->back;
178 const double carriageLength = dir.
length2D();
179 if (carriageLength > 0.0) {
182 double nbrLongitudinalCells, longitudinalOffset;
183 longitudinalOffset = std::modf((carriageLength - 2.0 * passengerRadius) / (2.0 * passengerRadius), &nbrLongitudinalCells);
184 double nbrLateralCells, lateralOffset;
185 lateralOffset = std::modf((
myHalfWidth * 2.0 - 2.0 * passengerRadius) / (2.0 * passengerRadius), &nbrLateralCells);
186 const Position gridOrigin = carriage->back + dir * (passengerRadius + 0.5 * longitudinalOffset) - perp * (
myHalfWidth - passengerRadius - 0.5 * lateralOffset);
187 for (
unsigned int i = 0; i <= (
unsigned int)nbrLongitudinalCells; i++) {
188 for (
unsigned int j = 0; j <= (
unsigned int)nbrLateralCells; j++) {
189 carriage->unboardingPositions.push_back(gridOrigin + dir * i * 2.0 * passengerRadius + perp * j * 2.0 * passengerRadius);
193 std::copy(carriage->unboardingPositions.begin(), carriage->unboardingPositions.end(), std::back_inserter(unboardingPositions));
202 if (upscale > 1 && length > 5 && width < 5 && vehicleQuality != 4) {
203 return MAX2(1.0, upscale * 5 / length);
#define MIN_SCALED_CARRIAGE_LENGTH
@ SVC_RAIL
vehicle is a not electrified rail
@ SVC_RAIL_FAST
vehicle that is allowed to drive on high-speed rail tracks
@ SVC_RAIL_ELECTRIC
rail vehicle that requires electrified tracks
const double INVALID_DOUBLE
invalid double
bool isReversed() const
Returns whether the logical state of the vehicle is reversed - for drawing.
const SUMOVehicleParameter::Stop * getNextStopParameter() const
return parameters for the next stop (SUMOVehicle Interface)
double getLength() const
Returns the vehicle's length.
bool isParking() const
Returns whether the vehicle is parking.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static bool gLefthand
Whether lefthand-drive is being simulated.
Representation of a lane in the micro simulation.
virtual double getLengthGeometryFactor(bool) const
double getLength() const
Returns the lane's length.
virtual const PositionVector & getShape(bool) const
double getWidth() const
Returns the lane's width.
double myFirstCarriageLength
void computeTrainDimensions(double exaggeration, bool secondaryShape, double scaledLength, int vehicleQuality)
const MSVehicle * myTrain
static const double PEDESTRIAN_RADIUS_EXTRA_TOLERANCE
small extra tolerance used to avoid constraint violations
std::vector< Carriage * > myCarriages
void computeDoorPositions()
compute door positions on demand and fills the carriage structures
double myLocomotiveLength
double myCarriageLengthWithGap
void computeUnboardingPositions(double passengerRadius, std::vector< Position > &unboardingPositions)
compute unboarding positions on demand and fills the carriage structures
int myFirstPassengerCarriage
double getUpscaleLength() const
void computeCarriages(bool reversed, bool secondaryShape)
const MSLane * getPreviousLane(const MSLane *current, int &furtherIndex) const
MSAbstractLaneChangeModel & getLaneChangeModel()
const MSLane * getLane() const
Returns the lane the vehicle is on.
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
double getPositionOnLane() const
Get the vehicle's position along the lane.
The car-following model and parameter.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double getLength() const
Get vehicle's length [m].
const SUMOVTypeParameter & getParameter() const
A point in 2D or 3D with translation and scaling methods.
void norm2D()
Normalizes the given vector.
double x() const
Returns the x-position.
double length2D() const
Computes the length of the given vector neglecting the z coordinate.
double y() const
Returns the y-position.
Position positionAtOffset2D(double pos, double lateralOffset=0, bool extrapolateBeyond=false) const
Returns the position at the given length.
static void shuffle(std::vector< T > &v, SumoRNG *rng=nullptr)
double locomotiveLength
the length of the locomotive
double carriageLength
the length of train carriages
int carriageDoors
the number of doors per carriage
double carriageGap
the length of the gap between carriages
double posLat
the lateral offset when stopping