forked from kscience/kmath
search for shortest path algorithm
This commit is contained in:
parent
81213eb943
commit
ea5305c8d8
@ -7,7 +7,9 @@ package space.kscience.kmath.trajectory
|
||||
|
||||
import space.kscience.kmath.geometry.Circle2D
|
||||
import space.kscience.kmath.geometry.Euclidean2DSpace.vector
|
||||
import space.kscience.kmath.geometry.equalsFloat
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class DubinsTest {
|
||||
@Test
|
||||
@ -31,7 +33,7 @@ class DubinsTest {
|
||||
finalRadius,
|
||||
obstacles)
|
||||
val length = pathLength(shortestPath(outputTangents))
|
||||
println(length)
|
||||
assertTrue(length.equalsFloat(27.2113183))
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -65,19 +67,7 @@ class DubinsTest {
|
||||
finalRadius,
|
||||
obstacles)
|
||||
val length = pathLength(shortestPath(paths))
|
||||
println(length)
|
||||
for (path in paths) {
|
||||
println(pathLength(path))
|
||||
println(path.size)
|
||||
for (tangent in path) {
|
||||
// println(tangent.route)
|
||||
// println(tangent.startCircle)
|
||||
// println(tangent.endCircle)
|
||||
// println(Euclidean2DSpace.norm(tangent.lineSegment.end - tangent.lineSegment.begin))
|
||||
}
|
||||
println()
|
||||
println()
|
||||
}
|
||||
assertTrue(length.equalsFloat(28.9678224))
|
||||
}
|
||||
@Test
|
||||
fun equalCircles() {
|
||||
|
@ -12,6 +12,7 @@ import space.kscience.kmath.geometry.LineSegment
|
||||
import space.kscience.kmath.geometry.equalsLine
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertFailsWith
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class TangentTest {
|
||||
@ -60,18 +61,4 @@ class TangentTest {
|
||||
val c2 = Circle2D(vector(0.0, 0.0), 1.0)
|
||||
assertEquals(emptyMap(), c1.tangentsToCircle(c2))
|
||||
}
|
||||
//
|
||||
// @Test
|
||||
// fun nonExistingTangents() {
|
||||
// assertFailsWith<NotImplementedError> {
|
||||
// val c1 = Circle2D(vector(0.0, 0.0), 1.0)
|
||||
// val c2 = Circle2D(vector(2.0, 0.0), 1.0)
|
||||
// c1.tangentsToCircle(c2)
|
||||
// }
|
||||
// assertFailsWith<NotImplementedError> {
|
||||
// val c1 = Circle2D(vector(0.0, 0.0), 1.0)
|
||||
// val c2 = Circle2D(vector(0.5, 0.0), 1.0)
|
||||
// c1.tangentsToCircle(c2)
|
||||
// }
|
||||
// }
|
||||
}
|
Loading…
Reference in New Issue
Block a user