Skip to content

Commit 0414fde

Browse files
committed
Move second map out of PoseMap
`PoseMap` is intended to be a SAM, and the `map()` overload is only there for convenience. Making it an extension method cleans up the interface. If performance is an issue, it can safely be moved back into the interface.
1 parent a25ccb0 commit 0414fde

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • core/src/main/kotlin/com/acmerobotics/roadrunner

core/src/main/kotlin/com/acmerobotics/roadrunner/Builders.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,9 +546,10 @@ class PathBuilder private constructor(
546546

547547
fun interface PoseMap {
548548
fun map(pose: Pose2dDual<Arclength>): Pose2dDual<Arclength>
549-
fun map(pose: Pose2d) = map(Pose2dDual.constant(pose, 1)).value()
550549
}
551550

551+
fun PoseMap.map(pose: Pose2d) = map(Pose2dDual.constant(pose, 1)).value()
552+
552553
class IdentityPoseMap : PoseMap {
553554
override fun map(pose: Pose2dDual<Arclength>) = pose
554555
}

0 commit comments

Comments
 (0)