Merge to update docs and contributions #504

Merged
altavir merged 199 commits from dev into master 2022-10-03 20:58:00 +03:00
Showing only changes of commit 4f88982734 - Show all commits

View File

@ -28,7 +28,8 @@ public class DubinsPathFactory(
public val shortest: DubinsPath get() = all.minByOrNull { it.length }!! public val shortest: DubinsPath get() = all.minByOrNull { it.length }!!
public operator fun get(type: DubinsPath.TYPE): DubinsPath? = all.find { it.type == type } public operator fun get(type: DubinsPath.TYPE): DubinsPath? = all.find { it.type == type }
public val rlr: DubinsPath? get () { public val rlr: DubinsPath?
get() {
val c1 = base.getRightCircle(turningRadius) val c1 = base.getRightCircle(turningRadius)
val c2 = direction.getRightCircle(turningRadius) val c2 = direction.getRightCircle(turningRadius)
val centers = Line2D(c1.center, c2.center) val centers = Line2D(c1.center, c2.center)
@ -50,7 +51,8 @@ public class DubinsPathFactory(
return DubinsPath(a1, a2, a3) return DubinsPath(a1, a2, a3)
} }
private val lrl: DubinsPath? get () { private val lrl: DubinsPath?
get() {
val c1 = base.getLeftCircle(turningRadius) val c1 = base.getLeftCircle(turningRadius)
val c2 = direction.getLeftCircle(turningRadius) val c2 = direction.getLeftCircle(turningRadius)
val centers = Line2D(c1.center, c2.center) val centers = Line2D(c1.center, c2.center)
@ -72,7 +74,8 @@ public class DubinsPathFactory(
return DubinsPath(a1, a2, a3) return DubinsPath(a1, a2, a3)
} }
public val rsr: DubinsPath get () { public val rsr: DubinsPath
get() {
val c1 = base.getRightCircle(turningRadius) val c1 = base.getRightCircle(turningRadius)
val c2 = direction.getRightCircle(turningRadius) val c2 = direction.getRightCircle(turningRadius)
val l = leftOuterTangent(c1, c2) val l = leftOuterTangent(c1, c2)
@ -91,7 +94,8 @@ public class DubinsPathFactory(
return DubinsPath(a1, LineSegment(l), a3) return DubinsPath(a1, LineSegment(l), a3)
} }
public val rsl: DubinsPath? get () { public val rsl: DubinsPath?
get() {
val c1 = base.getRightCircle(turningRadius) val c1 = base.getRightCircle(turningRadius)
val c2 = direction.getLeftCircle(turningRadius) val c2 = direction.getLeftCircle(turningRadius)
val l = rightInnerTangent(c1, c2) val l = rightInnerTangent(c1, c2)
@ -102,7 +106,8 @@ public class DubinsPathFactory(
return DubinsPath(a1, LineSegment(l), a3) return DubinsPath(a1, LineSegment(l), a3)
} }
public val lsr: DubinsPath? get () { public val lsr: DubinsPath?
get() {
val c1 = base.getLeftCircle(turningRadius) val c1 = base.getLeftCircle(turningRadius)
val c2 = direction.getRightCircle(turningRadius) val c2 = direction.getRightCircle(turningRadius)
val l = leftInnerTangent(c1, c2) val l = leftInnerTangent(c1, c2)
@ -140,7 +145,10 @@ private fun outerTangent(a: Circle, b: Circle, side: SIDE): Line2D {
a.center.y - a.radius * sin(centers.theta) a.center.y - a.radius * sin(centers.theta)
) )
} }
return Line2D(p1, Vector2D(p1.x + (centers.direction.x - centers.base.x), p1.y + (centers.direction.y - centers.base.y))) return Line2D(
p1,
Vector2D(p1.x + (centers.direction.x - centers.base.x), p1.y + (centers.direction.y - centers.base.y))
)
} }
private fun leftInnerTangent(base: Circle, direction: Circle) = innerTangent(base, direction, SIDE.LEFT) private fun leftInnerTangent(base: Circle, direction: Circle) = innerTangent(base, direction, SIDE.LEFT)