Skip to content

Commit

Permalink
Add failing test for straightLineIntersect
Browse files Browse the repository at this point in the history
Although the two lines share a vertex, maths precision in the calculation
means that the intersection isn't detected.
  • Loading branch information
davecraig committed Jan 9, 2025
1 parent 32b923d commit 4aac154
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.scottishtecharmy.soundscape.geoengine.utils

Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,15 @@ class GeoUtilsTest {
// These linestrings do not intersect
val intersect2 = lineStringsIntersect(lineString1, lineString3)
Assert.assertEquals(false, intersect2)

// These linestrings do intersect - they share a vertex
val intersect3 = straightLinesIntersect(
LngLatAlt(-4.305750131607056,55.947229354934144),
LngLatAlt(-4.30576890707016,55.947257891396816),
LngLatAlt(-4.306174131587852,55.946848076693094),
LngLatAlt(-4.305750131607056,55.947229354934144)
)
Assert.assertEquals(true, intersect3)
}

@Test
Expand Down

0 comments on commit 4aac154

Please sign in to comment.