@@ -149,9 +149,17 @@ TEST(JumpDistanceTest, isJumpBetween) {
149
149
slg::Point2D point1 (0.0 , 0.0 );
150
150
slg::Point2D point2 (0.5 , 0.35 );
151
151
152
+ // Calculate the jump distance when one of the points is NaN
153
+ bool is_jump = segmentation.is_jump_between (point1, slg::Point2D::quiet_NaN ());
154
+ EXPECT_TRUE (is_jump);
155
+ is_jump = segmentation.is_jump_between (slg::Point2D::quiet_NaN (), point2);
156
+ EXPECT_TRUE (is_jump);
157
+ is_jump = segmentation.is_jump_between (slg::Point2D::quiet_NaN (), slg::Point2D::quiet_NaN ());
158
+ EXPECT_TRUE (is_jump);
159
+
152
160
// Calculate the jump distance using Lee method
153
161
segmentation.initialize_segmentation (0.1 , 0.2 , 0.3 , " lee" );
154
- bool is_jump = segmentation.is_jump_between (point1, point2);
162
+ is_jump = segmentation.is_jump_between (point1, point2);
155
163
// Check the result: 0.61 > 1.0 is false
156
164
EXPECT_FALSE (is_jump);
157
165
@@ -199,7 +207,7 @@ TEST(JumpDistanceTest, performSegmentation) {
199
207
segmentation.initialize_segmentation (0.1 , 0.2 , 0.3 , " test" );
200
208
201
209
// Set points with a distance of 0.05
202
- std::vector<slg::Point2D> points = create_points (3 , 0.05 );
210
+ std::vector<slg::Point2D> points = create_points (5 , 0.05 );
203
211
points.push_back (slg::Point2D::quiet_NaN ());
204
212
// Perform the segmentation
205
213
std::vector<slg::Segment2D> segments;
@@ -209,12 +217,12 @@ TEST(JumpDistanceTest, performSegmentation) {
209
217
// and the distance between points is 0.05
210
218
EXPECT_EQ (segments.size (), 1 );
211
219
// Check the number of points in the segment
212
- // Should be 3 points in the segment
220
+ // Should be 5 points in the segment
213
221
// as the last point is a NaN point
214
- EXPECT_EQ (segments[0 ].size (), 3 );
222
+ EXPECT_EQ (segments[0 ].size (), points. size ()- 1 );
215
223
216
224
// Now we set the points with a distance of 1.0
217
- points = create_points (3 , 1.0 );
225
+ points = create_points (5 , 1.0 );
218
226
// Perform the segmentation
219
227
segments.clear ();
220
228
segmentation.perform_segmentation (points, segments);
0 commit comments