Fix curveInDirection

This commit is contained in:
Alexander Nozik 2022-10-08 13:39:52 +03:00
parent 3e31effa80
commit c8c6aef24e
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
5 changed files with 24 additions and 21 deletions

View File

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

View File

@ -1,10 +1,11 @@
package center.sciprog.maps.compose package center.sciprog.maps.compose
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.ImageBitmap import androidx.compose.ui.graphics.*
import androidx.compose.ui.graphics.PointMode
import androidx.compose.ui.graphics.drawscope.DrawScope import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.drawscope.DrawStyle
import androidx.compose.ui.graphics.drawscope.Fill
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.VectorPainter import androidx.compose.ui.graphics.vector.VectorPainter
import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.graphics.vector.rememberVectorPainter
@ -57,20 +58,20 @@ public class MapDrawFeature(
MapDrawFeature(newCoordinates, zoomRange, drawFeature) MapDrawFeature(newCoordinates, zoomRange, drawFeature)
} }
//public class MapPathFeature( public class MapPathFeature(
// public val rectangle: GmcRectangle, public val rectangle: GmcRectangle,
// public val path: Path, public val path: Path,
// public val brush: Brush, public val brush: Brush,
// public val style: DrawStyle = Fill, public val style: DrawStyle = Fill,
// public val targetRect: Rect = path.getBounds(), public val targetRect: Rect = path.getBounds(),
// override val zoomRange: IntRange = defaultZoomRange, override val zoomRange: IntRange = defaultZoomRange,
//) : DraggableMapFeature { ) : DraggableMapFeature {
// override fun withCoordinates(newCoordinates: GeodeticMapCoordinates): MapFeature = override fun withCoordinates(newCoordinates: GeodeticMapCoordinates): MapFeature =
// MapPathFeature(rectangle.moveTo(newCoordinates), path, brush, style, targetRect, zoomRange) MapPathFeature(rectangle.moveTo(newCoordinates), path, brush, style, targetRect, zoomRange)
//
// override fun getBoundingBox(zoom: Double): GmcRectangle = rectangle override fun getBoundingBox(zoom: Double): GmcRectangle = rectangle
//
//} }
public class MapPointsFeature( public class MapPointsFeature(
public val points: List<GeodeticMapCoordinates>, public val points: List<GeodeticMapCoordinates>,

View File

@ -303,13 +303,14 @@ public actual fun MapView(
} }
} }
// is MapPathFeature -> { is MapPathFeature -> {
TODO("MapPathFeature not implemented")
// val offset = feature.rectangle.center.toOffset() - feature.targetRect.center // val offset = feature.rectangle.center.toOffset() - feature.targetRect.center
// translate(offset.x, offset.y) { // translate(offset.x, offset.y) {
// sca // sca
// drawPath(feature.path, brush = feature.brush, style = feature.style) // drawPath(feature.path, brush = feature.brush, style = feature.style)
// } // }
// } }
is MapPointsFeature -> { is MapPointsFeature -> {
val points = feature.points.map { it.toOffset() } val points = feature.points.map { it.toOffset() }

View File

@ -190,7 +190,7 @@ public fun GeoEllipsoid.curveInDirection(
val L = lambda - (1 - C) * f * sinAlpha * val L = lambda - (1 - C) * f * sinAlpha *
(sigma.value + C * sinSigma * (cosSigmaM2 + C * cosSigma * (-1 + 2 * cos2SigmaM2))) (sigma.value + C * sinSigma * (cosSigmaM2 + C * cosSigma * (-1 + 2 * cos2SigmaM2)))
val endPoint = Gmc(phi2, L.radians) val endPoint = Gmc(phi2, start.longitude + L.radians)
// eq. 12 // eq. 12

View File

@ -30,5 +30,6 @@ internal class DistanceTest {
) )
assertEquals(spb.latitude.radians.value,curve.backward.latitude.radians.value, 0.0001) assertEquals(spb.latitude.radians.value,curve.backward.latitude.radians.value, 0.0001)
assertEquals(spb.longitude.radians.value,curve.backward.longitude.radians.value, 0.0001)
} }
} }