Program: 186346
Project: 186346
Buggy source:
private void renderStepsTo(Target<?> target){
  WaySegmentElevationProfile elevationProfile=line.getElevationProfile();
  final VectorXZ startWithOffset=getStartPosition();
  final VectorXZ endWithOffset=getEndPosition();
  List<VectorXYZ> leftOutline=getOutline(false);
  List<VectorXYZ> rightOutline=getOutline(true);
  double lineLength=VectorXZ.distance(line.getStartNode().getPos(),line.getEndNode().getPos());
  List<VectorXYZ> vs=createTriangleStripBetween(leftOutline,rightOutline);
  target.drawTriangleStrip(ASPHALT,vs,null);
  float stepLength=0.3f;
  if (tags.containsKey("String_Node_Str")) {
    try {
      int stepCount=Integer.parseInt(tags.getValue("String_Node_Str"));
      stepLength=(float)lineLength / stepCount;
    }
 catch (    NumberFormatException e) {
    }
  }
  List<VectorXZ> stepBorderPositionsXZ=GeometryUtil.equallyDistributePointsAlong(stepLength,true,startWithOffset,endWithOffset);
  List<VectorXYZ> stepBorderPositions=new ArrayList<VectorXYZ>();
  for (  VectorXZ posXZ : stepBorderPositionsXZ) {
    VectorXYZ posXYZ=posXZ.xyz(elevationProfile.getEleAt(posXZ));
    stepBorderPositions.add(posXYZ);
  }
  for (int step=0; step < stepBorderPositions.size() - 1; step++) {
    VectorXYZ frontCenter=stepBorderPositions.get(step);
    VectorXYZ backCenter=stepBorderPositions.get(step + 1);
    double height=abs(frontCenter.y - backCenter.y);
    VectorXYZ center=(frontCenter.add(backCenter)).mult(0.5);
    center=center.subtract(Y_UNIT.mult(0.5 * height));
    VectorXZ faceDirection=line.getDirection();
    if (frontCenter.y < backCenter.y) {
      faceDirection=faceDirection.invert();
    }
    target.drawBox(Materials.STEPS_DEFAULT,center,faceDirection,height,width,backCenter.distanceToXZ(frontCenter));
  }
  List<List<VectorXYZ>> handrailFootprints=new ArrayList<List<VectorXYZ>>();
  if (line.getTags().contains("String_Node_Str","String_Node_Str")) {
    handrailFootprints.add(leftOutline);
  }
  if (line.getTags().contains("String_Node_Str","String_Node_Str")) {
    handrailFootprints.add(rightOutline);
  }
  int centerHandrails=0;
  if (line.getTags().contains("String_Node_Str","String_Node_Str")) {
    centerHandrails=1;
  }
 else   if (line.getTags().containsKey("String_Node_Str")) {
    try {
      centerHandrails=Integer.parseInt(line.getTags().getValue("String_Node_Str"));
    }
 catch (    NumberFormatException e) {
    }
  }
  for (int i=0; i < centerHandrails; i++) {
    handrailFootprints.add(createLineBetween(leftOutline,rightOutline,(i + 1.0f) / (centerHandrails + 1)));
  }
  for (  List<VectorXYZ> handrailFootprint : handrailFootprints) {
    List<VectorXYZ> handrailLine=new ArrayList<VectorXYZ>();
    for (    VectorXYZ v : handrailFootprint) {
      handrailLine.add(v.y(v.y + 1));
    }
    List<List<VectorXYZ>> strips=createShapeExtrusionAlong(HANDRAIL_SHAPE,handrailLine,Collections.nCopies(handrailLine.size(),VectorXYZ.Y_UNIT));
    for (    List<VectorXYZ> strip : strips) {
      target.drawTriangleStrip(HANDRAIL_DEFAULT,strip,null);
    }
    target.drawColumn(HANDRAIL_DEFAULT,4,handrailFootprint.get(0),1,0.03,0.03,false,true);
    target.drawColumn(HANDRAIL_DEFAULT,4,handrailFootprint.get(handrailFootprint.size() - 1),1,0.03,0.03,false,true);
  }
}

Fixed version (ground truth):
private void renderStepsTo(Target<?> target){
  WaySegmentElevationProfile elevationProfile=line.getElevationProfile();
  final VectorXZ startWithOffset=getStartPosition();
  final VectorXZ endWithOffset=getEndPosition();
  List<VectorXYZ> leftOutline=getOutline(false);
  List<VectorXYZ> rightOutline=getOutline(true);
  double lineLength=VectorXZ.distance(line.getStartNode().getPos(),line.getEndNode().getPos());
  List<VectorXYZ> vs=createTriangleStripBetween(leftOutline,rightOutline);
  target.drawTriangleStrip(ASPHALT,vs,globalTexCoordLists(vs,ASPHALT,false));
  float stepLength=0.3f;
  if (tags.containsKey("String_Node_Str")) {
    try {
      int stepCount=Integer.parseInt(tags.getValue("String_Node_Str"));
      stepLength=(float)lineLength / stepCount;
    }
 catch (    NumberFormatException e) {
    }
  }
  List<VectorXZ> stepBorderPositionsXZ=GeometryUtil.equallyDistributePointsAlong(stepLength,true,startWithOffset,endWithOffset);
  List<VectorXYZ> stepBorderPositions=new ArrayList<VectorXYZ>();
  for (  VectorXZ posXZ : stepBorderPositionsXZ) {
    VectorXYZ posXYZ=posXZ.xyz(elevationProfile.getEleAt(posXZ));
    stepBorderPositions.add(posXYZ);
  }
  for (int step=0; step < stepBorderPositions.size() - 1; step++) {
    VectorXYZ frontCenter=stepBorderPositions.get(step);
    VectorXYZ backCenter=stepBorderPositions.get(step + 1);
    double height=abs(frontCenter.y - backCenter.y);
    VectorXYZ center=(frontCenter.add(backCenter)).mult(0.5);
    center=center.subtract(Y_UNIT.mult(0.5 * height));
    VectorXZ faceDirection=line.getDirection();
    if (frontCenter.y < backCenter.y) {
      faceDirection=faceDirection.invert();
    }
    target.drawBox(Materials.STEPS_DEFAULT,center,faceDirection,height,width,backCenter.distanceToXZ(frontCenter));
  }
  List<List<VectorXYZ>> handrailFootprints=new ArrayList<List<VectorXYZ>>();
  if (line.getTags().contains("String_Node_Str","String_Node_Str")) {
    handrailFootprints.add(leftOutline);
  }
  if (line.getTags().contains("String_Node_Str","String_Node_Str")) {
    handrailFootprints.add(rightOutline);
  }
  int centerHandrails=0;
  if (line.getTags().contains("String_Node_Str","String_Node_Str")) {
    centerHandrails=1;
  }
 else   if (line.getTags().containsKey("String_Node_Str")) {
    try {
      centerHandrails=Integer.parseInt(line.getTags().getValue("String_Node_Str"));
    }
 catch (    NumberFormatException e) {
    }
  }
  for (int i=0; i < centerHandrails; i++) {
    handrailFootprints.add(createLineBetween(leftOutline,rightOutline,(i + 1.0f) / (centerHandrails + 1)));
  }
  for (  List<VectorXYZ> handrailFootprint : handrailFootprints) {
    List<VectorXYZ> handrailLine=new ArrayList<VectorXYZ>();
    for (    VectorXYZ v : handrailFootprint) {
      handrailLine.add(v.y(v.y + 1));
    }
    List<List<VectorXYZ>> strips=createShapeExtrusionAlong(HANDRAIL_SHAPE,handrailLine,Collections.nCopies(handrailLine.size(),VectorXYZ.Y_UNIT));
    for (    List<VectorXYZ> strip : strips) {
      target.drawTriangleStrip(HANDRAIL_DEFAULT,strip,wallTexCoordLists(strip,HANDRAIL_DEFAULT));
    }
    target.drawColumn(HANDRAIL_DEFAULT,4,handrailFootprint.get(0),1,0.03,0.03,false,true);
    target.drawColumn(HANDRAIL_DEFAULT,4,handrailFootprint.get(handrailFootprint.size() - 1),1,0.03,0.03,false,true);
  }
}