Skip to content

Commit

Permalink
Moved a constant in the train helper.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoueraud87 authored and behrisch committed Feb 19, 2024
1 parent 737f97c commit 435e440
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/microsim/MSTrainHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include <microsim/MSVehicle.h>
#include "MSTrainHelper.h"


const double MSTrainHelper::DEFAULT_CARRIAGE_DOOR_WIDTH = 1.5;

// ===========================================================================
// method definitions
// ===========================================================================
Expand Down
2 changes: 2 additions & 0 deletions src/microsim/MSTrainHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class MSTrainHelper {

// Compute the rectangles from the front and back positions.
std::vector<PositionVector> getCarriageShapes(void);

static const double DEFAULT_CARRIAGE_DOOR_WIDTH;

private:
const MSVehicle* myTrain;
Expand Down
4 changes: 1 addition & 3 deletions src/microsim/transportables/MSStageDriving.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
#include <microsim/transportables/MSPerson.h>


#define DEFAULT_CARRIAGE_DOOR_WIDTH 1.5

// ===========================================================================
// method definitions
// ===========================================================================
Expand Down Expand Up @@ -441,7 +439,7 @@ MSStageDriving::setArrived(MSNet* net, MSTransportable* transportable, SUMOTime
// Jitter the position before projection because of possible train curvature.
Position direction = randomCarriage->front - randomCarriage->back;
direction.norm2D();
randomDoor.add(direction * RandHelper::rand(-0.5 * DEFAULT_CARRIAGE_DOOR_WIDTH, 0.5 * DEFAULT_CARRIAGE_DOOR_WIDTH));
randomDoor.add(direction * RandHelper::rand(-0.5 * MSTrainHelper::DEFAULT_CARRIAGE_DOOR_WIDTH, 0.5 * MSTrainHelper::DEFAULT_CARRIAGE_DOOR_WIDTH));
// Project onto the lane.
myArrivalPos = myVehicle->getLane()->getShape().nearest_offset_to_point2D(randomDoor);
myArrivalPos = myVehicle->getLane()->interpolateGeometryPosToLanePos(myArrivalPos);
Expand Down

0 comments on commit 435e440

Please sign in to comment.