@@ -213,7 +213,7 @@ mod test {
213
213
FalseIntersectionPointType , LineIntersectionWithParameterResult ,
214
214
LineSegmentIntersectionType ,
215
215
} ;
216
- use crate :: Coord ;
216
+ use crate :: { Coord , coord } ;
217
217
use FalseIntersectionPointType :: { AfterEnd , BeforeStart } ;
218
218
use LineSegmentIntersectionType :: { FalseIntersectionPoint , TrueIntersectionPoint } ;
219
219
@@ -269,6 +269,12 @@ mod test {
269
269
let b = Coord { x : 2f64 , y : 3f64 } ;
270
270
let c = Coord { x : 0f64 , y : 2f64 } ;
271
271
let d = Coord { x : -2f64 , y : 6f64 } ;
272
+
273
+ fn check_intersection ( intersection : Coord < f64 > ) {
274
+ let diff = intersection - Coord { x : 1f64 / 3f64 , y : 4f64 / 3f64 } ;
275
+ assert ! ( diff. x * diff. x + diff. y * diff. y < 0.00000000001f64 ) ;
276
+ }
277
+
272
278
if let Some ( LineIntersectionWithParameterResult {
273
279
ab,
274
280
cd,
@@ -277,14 +283,7 @@ mod test {
277
283
{
278
284
assert_eq ! ( ab, FalseIntersectionPoint ( BeforeStart ) ) ;
279
285
assert_eq ! ( cd, FalseIntersectionPoint ( BeforeStart ) ) ;
280
- println ! ( "{intersection:?}" ) ;
281
- let diff = intersection
282
- - Coord {
283
- x : 1.0 / 3.0f64 ,
284
- y : 4.0 / 3.0f64 ,
285
- } ;
286
- println ! ( "{diff:?}" ) ;
287
- assert ! ( diff. x * diff. x + diff. y * diff. y < 0.00000000001f64 ) ;
286
+ check_intersection ( intersection) ;
288
287
} else {
289
288
assert ! ( false ) ;
290
289
}
@@ -297,14 +296,7 @@ mod test {
297
296
{
298
297
assert_eq ! ( ab, FalseIntersectionPoint ( AfterEnd ) ) ;
299
298
assert_eq ! ( cd, FalseIntersectionPoint ( BeforeStart ) ) ;
300
- println ! ( "{intersection:?}" ) ;
301
- let diff = intersection
302
- - Coord {
303
- x : 1.0 / 3.0f64 ,
304
- y : 4.0 / 3.0f64 ,
305
- } ;
306
- println ! ( "{diff:?}" ) ;
307
- assert ! ( diff. x * diff. x + diff. y * diff. y < 0.00000000001f64 ) ;
299
+ check_intersection ( intersection) ;
308
300
} else {
309
301
assert ! ( false ) ;
310
302
}
@@ -317,14 +309,7 @@ mod test {
317
309
{
318
310
assert_eq ! ( ab, FalseIntersectionPoint ( BeforeStart ) ) ;
319
311
assert_eq ! ( cd, FalseIntersectionPoint ( AfterEnd ) ) ;
320
- println ! ( "{intersection:?}" ) ;
321
- let diff = intersection
322
- - Coord {
323
- x : 1.0 / 3.0f64 ,
324
- y : 4.0 / 3.0f64 ,
325
- } ;
326
- println ! ( "{diff:?}" ) ;
327
- assert ! ( diff. x * diff. x + diff. y * diff. y < 0.00000000001f64 ) ;
312
+ check_intersection ( intersection) ;
328
313
} else {
329
314
assert ! ( false ) ;
330
315
}
0 commit comments