Fix arc builder

This commit is contained in:
Alexander Nozik 2022-09-11 22:24:53 +03:00
parent 8e143eb81c
commit 890a1bceca
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
4 changed files with 8 additions and 6 deletions

View File

@ -10,7 +10,7 @@ val ktorVersion by extra("2.0.3")
allprojects {
group = "center.sciprog"
version = "0.1.0-dev-2"
version = "0.1.0-dev-3"
}
ksciencePublish{

View File

@ -23,6 +23,7 @@ import java.nio.file.Path
import kotlin.math.PI
import kotlin.random.Random
import center.sciprog.maps.coordinates.kilometers
import center.sciprog.maps.coordinates.radians
private fun GeodeticMapCoordinates.toShortString(): String =
"${(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)
}
arc(pointOne, 10.0.kilometers, 0f, PI)
arc(pointOne, 10.0.kilometers, 0f.radians, PI.radians)
line(pointOne, pointTwo, id = "line")
text(pointOne, "Home", font = { size = 32f })

View File

@ -146,8 +146,8 @@ public fun MapFeatureBuilder.arc(
public fun MapFeatureBuilder.arc(
center: Pair<Double, Double>,
radius: Distance,
startAngle: Number,
endAngle: Number,
startAngle: Angle,
endAngle: Angle,
zoomRange: IntRange = defaultZoomRange,
color: Color = Color.Red,
id: FeatureId? = null,
@ -155,8 +155,8 @@ public fun MapFeatureBuilder.arc(
id,
MapArcFeature(
GmcRectangle.square(center.toCoordinates(), radius, radius),
startAngle.degrees,
endAngle.degrees,
startAngle,
endAngle,
zoomRange,
color
)

View File

@ -20,6 +20,7 @@ internal class DistanceTest {
val distance = curve.distance
assertEquals(632.035426877, distance.kilometers, 0.0001)
assertEquals((-0.6947937116552751).radians, curve.forward.bearing)
}
@Test