Fix arc builder
This commit is contained in:
parent
8e143eb81c
commit
890a1bceca
@ -10,7 +10,7 @@ val ktorVersion by extra("2.0.3")
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = "center.sciprog"
|
group = "center.sciprog"
|
||||||
version = "0.1.0-dev-2"
|
version = "0.1.0-dev-3"
|
||||||
}
|
}
|
||||||
|
|
||||||
ksciencePublish{
|
ksciencePublish{
|
||||||
|
@ -23,6 +23,7 @@ import java.nio.file.Path
|
|||||||
import kotlin.math.PI
|
import kotlin.math.PI
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
import center.sciprog.maps.coordinates.kilometers
|
import center.sciprog.maps.coordinates.kilometers
|
||||||
|
import center.sciprog.maps.coordinates.radians
|
||||||
|
|
||||||
private fun GeodeticMapCoordinates.toShortString(): String =
|
private fun GeodeticMapCoordinates.toShortString(): String =
|
||||||
"${(latitude.degrees.value).toString().take(6)}:${(longitude.degrees.value).toString().take(6)}"
|
"${(latitude.degrees.value).toString().take(6)}:${(longitude.degrees.value).toString().take(6)}"
|
||||||
@ -91,7 +92,7 @@ fun App() {
|
|||||||
drawLine(start = Offset(-10f, 10f), end = Offset(10f, -10f), color = Color.Red)
|
drawLine(start = Offset(-10f, 10f), end = Offset(10f, -10f), color = Color.Red)
|
||||||
}
|
}
|
||||||
|
|
||||||
arc(pointOne, 10.0.kilometers, 0f, PI)
|
arc(pointOne, 10.0.kilometers, 0f.radians, PI.radians)
|
||||||
|
|
||||||
line(pointOne, pointTwo, id = "line")
|
line(pointOne, pointTwo, id = "line")
|
||||||
text(pointOne, "Home", font = { size = 32f })
|
text(pointOne, "Home", font = { size = 32f })
|
||||||
|
@ -146,8 +146,8 @@ public fun MapFeatureBuilder.arc(
|
|||||||
public fun MapFeatureBuilder.arc(
|
public fun MapFeatureBuilder.arc(
|
||||||
center: Pair<Double, Double>,
|
center: Pair<Double, Double>,
|
||||||
radius: Distance,
|
radius: Distance,
|
||||||
startAngle: Number,
|
startAngle: Angle,
|
||||||
endAngle: Number,
|
endAngle: Angle,
|
||||||
zoomRange: IntRange = defaultZoomRange,
|
zoomRange: IntRange = defaultZoomRange,
|
||||||
color: Color = Color.Red,
|
color: Color = Color.Red,
|
||||||
id: FeatureId? = null,
|
id: FeatureId? = null,
|
||||||
@ -155,8 +155,8 @@ public fun MapFeatureBuilder.arc(
|
|||||||
id,
|
id,
|
||||||
MapArcFeature(
|
MapArcFeature(
|
||||||
GmcRectangle.square(center.toCoordinates(), radius, radius),
|
GmcRectangle.square(center.toCoordinates(), radius, radius),
|
||||||
startAngle.degrees,
|
startAngle,
|
||||||
endAngle.degrees,
|
endAngle,
|
||||||
zoomRange,
|
zoomRange,
|
||||||
color
|
color
|
||||||
)
|
)
|
||||||
|
@ -20,6 +20,7 @@ internal class DistanceTest {
|
|||||||
val distance = curve.distance
|
val distance = curve.distance
|
||||||
|
|
||||||
assertEquals(632.035426877, distance.kilometers, 0.0001)
|
assertEquals(632.035426877, distance.kilometers, 0.0001)
|
||||||
|
assertEquals((-0.6947937116552751).radians, curve.forward.bearing)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user