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