refactoring directions

This commit is contained in:
Alexander Nozik 2023-04-04 17:42:40 +03:00
parent 1e46ffbd98
commit f5201b6be0

View File

@ -69,7 +69,7 @@ internal fun Circle2D.tangentsToCircle(
} else { } else {
angle1 - r2.sign * atan2(r.absoluteValue, l) angle1 - r2.sign * atan2(r.absoluteValue, l)
} }
val w = Euclidean2DSpace.vector(-cos(angle2), sin(angle2)) val w = vector(-cos(angle2), sin(angle2))
put( put(
route, route,
LineSegment( LineSegment(
@ -412,7 +412,7 @@ private fun sortedObstacles(
currentObstacle: Obstacle, currentObstacle: Obstacle,
obstacles: List<Obstacle>, obstacles: List<Obstacle>,
): List<Obstacle> { ): List<Obstacle> {
return obstacles.sortedBy { norm(it.center - currentObstacle.center) }//.reversed() return obstacles.sortedBy { norm(it.center - currentObstacle.center) }
} }
private fun tangentsAlongTheObstacle( private fun tangentsAlongTheObstacle(
@ -580,7 +580,6 @@ internal fun findAllPaths(
newPaths.add(TangentPath(tangentPath.tangents + tangentsAlong + tangent)) newPaths.add(TangentPath(tangentPath.tangents + tangentsAlong + tangent))
} }
} else { } else {
// minor changes from Python code
newPaths.add(tangentPath) newPaths.add(tangentPath)
} }
} }