Fix visibility in Trajectory2D
This commit is contained in:
parent
fb0d016aa8
commit
94489b28e2
@ -1,3 +1,4 @@
|
||||
import space.kscience.gradle.isInDevelopment
|
||||
import space.kscience.gradle.useApache2Licence
|
||||
import space.kscience.gradle.useSPCTeam
|
||||
|
||||
@ -77,12 +78,11 @@ ksciencePublish {
|
||||
}
|
||||
github("kmath", "SciProgCentre")
|
||||
space(
|
||||
"https://maven.pkg.jetbrains.space/spc/p/sci/maven"
|
||||
// if (isInDevelopment) {
|
||||
// "https://maven.pkg.jetbrains.space/spc/p/sci/dev"
|
||||
// } else {
|
||||
// "https://maven.pkg.jetbrains.space/spc/p/sci/release"
|
||||
// }
|
||||
if (isInDevelopment) {
|
||||
"https://maven.pkg.jetbrains.space/spc/p/sci/dev"
|
||||
} else {
|
||||
"https://maven.pkg.jetbrains.space/spc/p/sci/maven"
|
||||
}
|
||||
)
|
||||
sonatype()
|
||||
}
|
||||
|
6
docs/templates/ARTIFACT-TEMPLATE.md
vendored
6
docs/templates/ARTIFACT-TEMPLATE.md
vendored
@ -3,10 +3,12 @@
|
||||
The Maven coordinates of this project are `${group}:${name}:${version}`.
|
||||
|
||||
**Gradle:**
|
||||
```gradle
|
||||
```groovy
|
||||
repositories {
|
||||
maven { url 'https://repo.kotlin.link' }
|
||||
mavenCentral()
|
||||
// development and snapshot versions
|
||||
maven { url 'https://maven.pkg.jetbrains.space/spc/p/sci/dev' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@ -18,6 +20,8 @@ dependencies {
|
||||
repositories {
|
||||
maven("https://repo.kotlin.link")
|
||||
mavenCentral()
|
||||
// development and snapshot versions
|
||||
maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -24,7 +24,7 @@ public class PhaseVector2D(
|
||||
override val bearing: Double get() = atan2(velocity.x, velocity.y)
|
||||
}
|
||||
|
||||
internal class Pose2DImpl(
|
||||
private class DubinsPose2DImpl(
|
||||
override val coordinate: DoubleVector2D,
|
||||
override val bearing: Double,
|
||||
) : DubinsPose2D, DoubleVector2D by coordinate{
|
||||
@ -33,4 +33,4 @@ internal class Pose2DImpl(
|
||||
}
|
||||
|
||||
|
||||
public fun Pose2D(coordinate: DoubleVector2D, theta: Double): DubinsPose2D = Pose2DImpl(coordinate, theta)
|
||||
public fun DubinsPose2D(coordinate: DoubleVector2D, theta: Double): DubinsPose2D = DubinsPose2DImpl(coordinate, theta)
|
@ -19,12 +19,12 @@ public sealed interface Trajectory2D {
|
||||
* Straight path segment. The order of start and end defines the direction
|
||||
*/
|
||||
public data class StraightTrajectory2D(
|
||||
internal val start: DoubleVector2D,
|
||||
internal val end: DoubleVector2D,
|
||||
public val start: DoubleVector2D,
|
||||
public val end: DoubleVector2D,
|
||||
) : Trajectory2D {
|
||||
override val length: Double get() = start.distanceTo(end)
|
||||
|
||||
internal val bearing: Double get() = theta(atan2(end.x - start.x, end.y - start.y))
|
||||
public val bearing: Double get() = theta(atan2(end.x - start.x, end.y - start.y))
|
||||
}
|
||||
|
||||
/**
|
||||
@ -56,7 +56,7 @@ public data class CircleTrajectory2D(
|
||||
circle.radius * arcLength
|
||||
}
|
||||
|
||||
internal val direction: Direction by lazy {
|
||||
public val direction: Direction by lazy {
|
||||
if (start.y < circle.center.y) {
|
||||
if (start.bearing > PI) Direction.RIGHT else Direction.LEFT
|
||||
} else if (start.y > circle.center.y) {
|
||||
@ -81,7 +81,7 @@ public data class CircleTrajectory2D(
|
||||
vector: DoubleVector2D,
|
||||
theta: Double,
|
||||
direction: Direction,
|
||||
): DubinsPose2D = Pose2D(
|
||||
): DubinsPose2D = DubinsPose2D(
|
||||
vector,
|
||||
when (direction) {
|
||||
Direction.LEFT -> theta(theta - PI / 2)
|
||||
|
@ -19,8 +19,8 @@ class DubinsTests {
|
||||
val straight = StraightTrajectory2D(vector(0.0, 0.0), vector(100.0, 100.0))
|
||||
val lineP1 = straight.shift(1, 10.0).inverse()
|
||||
|
||||
val start = Pose2D(straight.end, straight.bearing)
|
||||
val end = Pose2D(lineP1.start, lineP1.bearing)
|
||||
val start = DubinsPose2D(straight.end, straight.bearing)
|
||||
val end = DubinsPose2D(lineP1.start, lineP1.bearing)
|
||||
val radius = 2.0
|
||||
val dubins = DubinsPath.all(start, end, radius)
|
||||
|
||||
@ -51,8 +51,8 @@ class DubinsTests {
|
||||
assertTrue(path.c.start.equalsFloat(b.end))
|
||||
} else if (path.b is StraightTrajectory2D) {
|
||||
val b = path.b as StraightTrajectory2D
|
||||
assertTrue(path.a.end.equalsFloat(Pose2D(b.start, b.bearing)))
|
||||
assertTrue(path.c.start.equalsFloat(Pose2D(b.end, b.bearing)))
|
||||
assertTrue(path.a.end.equalsFloat(DubinsPose2D(b.start, b.bearing)))
|
||||
assertTrue(path.c.start.equalsFloat(DubinsPose2D(b.end, b.bearing)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user