Sfoglia il codice sorgente

change driver_map_xodrload. fix a bug in laneoffset plan.

yuchuli 3 anni fa
parent
commit
e0fcf7f723
1 ha cambiato i file con 21 aggiunte e 0 eliminazioni
  1. 21 0
      src/driver/driver_map_xodrload/globalplan.cpp

+ 21 - 0
src/driver/driver_map_xodrload/globalplan.cpp

@@ -1948,6 +1948,27 @@ double getoff(Road * pRoad,int nlane,const double s)
 
 
     }
     }
 
 
+    if(pRoad->GetLaneOffsetCount()>0)
+    {
+
+        int nLOCount = pRoad->GetLaneOffsetCount();
+        int isel = -1;
+        for(i=0;i<(nLOCount-1);i++)
+        {
+            if(pRoad->GetLaneOffset(i+1)->GetS()>s)
+            {
+                isel = i;
+                break;
+            }
+        }
+        if(isel < 0)isel = nLOCount-1;
+        LaneOffset * pLO = pRoad->GetLaneOffset(isel);
+        double s_off = s - pLO->GetS();
+        double off1 = pLO->Geta() + pLO->Getb()*s_off + pLO->Getc() * s_off * s_off
+                +pLO->Getd() * s_off * s_off * s_off;
+        foff = foff - off1;
+    }
+
     if(nlane<0)foff = foff*(-1);
     if(nlane<0)foff = foff*(-1);
     return foff;
     return foff;
 }
 }