diff --git a/test/algo/test_cinematics.py b/test/algo/test_cinematics.py index 0907cc2..2ff5899 100644 --- a/test/algo/test_cinematics.py +++ b/test/algo/test_cinematics.py @@ -18,7 +18,7 @@ computeSwitchbacks, smoothed_speed_calculation, computeAbsCurv, - computeAbsCurvAnotherPoint, +# computeAbsCurvAnotherPoint, estimate_heading, computeAvgSpeed, computeAvgAscSpeed, @@ -284,9 +284,9 @@ def testAbsCurv(self): self.assertEqual(self.trace1.getObsAnalyticalFeature(BIAF_ABS_CURV, 2), 20) self.assertEqual(self.trace1.getObsAnalyticalFeature(BIAF_ABS_CURV, 8), 90) - self.assertEqual(computeAbsCurvAnotherPoint(self.trace1, 1, 1), 1) - self.assertEqual(computeAbsCurvAnotherPoint(self.trace1, 18, 8), 28) - self.assertEqual(computeAbsCurvAnotherPoint(self.trace1, 57, 35), 87) + #self.assertEqual(computeAbsCurvAnotherPoint(self.trace1, 1, 1), 1) + #self.assertEqual(computeAbsCurvAnotherPoint(self.trace1, 18, 8), 28) + #self.assertEqual(computeAbsCurvAnotherPoint(self.trace1, 57, 35), 87) def testEstimateHeading(self): diff --git a/tracklib/algo/cinematics.py b/tracklib/algo/cinematics.py index 02988bb..94d6fa5 100644 --- a/tracklib/algo/cinematics.py +++ b/tracklib/algo/cinematics.py @@ -160,6 +160,7 @@ def computeCurvAbsBetweenTwoPoints(track, id_ini=0, id_fin=None): return s +''' def computeAbsCurvAnotherPoint(track, x, y): """Computes the curvilinear abscissa of the projection of a point onto a track""" distmin, xproj, yproj, iproj = proj_polyligne(track.getX(), track.getY(), x, y) @@ -169,7 +170,7 @@ def computeAbsCurvAnotherPoint(track, x, y): d = track[iproj].distanceTo(Obs(ENUCoords(xproj, yproj), ObsTime())) s = computeCurvAbsBetweenTwoPoints(track, 0, iproj) + d return s - +''' def computeNetDeniv(track, id_ini=0, id_fin=None): """Computes net denivellation (in meters)""" diff --git a/tracklib/util/geometry.py b/tracklib/util/geometry.py index d27976a..39610d2 100644 --- a/tracklib/util/geometry.py +++ b/tracklib/util/geometry.py @@ -382,7 +382,12 @@ def detect_side(track, x, y, seuilMemeProj=0.1): dist, xp, yp = proj_segment([xa, ya, xb, yb], x, y) - abscurv = tracklib.computeAbsCurvAnotherPoint(track, xp, yp) + # abscurv = tracklib.computeAbsCurvAnotherPoint(track, xp, yp) + if iproj == 0: + abscurv = track.getFirstObs().distanceTo(tracklib.Obs(tracklib.ENUCoords(xp, yp), tracklib.ObsTime())) + else: + d = track[iproj].distanceTo(tracklib.Obs(tracklib.ENUCoords(xp, yp), tracklib.ObsTime())) + abscurv = tracklib.computeCurvAbsBetweenTwoPoints(track, 0, iproj) + d if pdt > 0: SIDES.append((dist, xp, yp, 1, abscurv))