Skip to content

Commit

Permalink
Fixed radius
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanOltmann committed Nov 10, 2024
1 parent 8f1f824 commit 70a0bbe
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions app/src/commonMain/kotlin/ui/SpacedOutStarMapView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,18 @@ fun SpacedOutStarMapView(
) {

val clusterType = cluster.cluster
val radius = clusterType.starmapRadius

val radius = clusterType.starmapRadius - 1

HexagonalGrid(radius)


val hexSize =
minOf(maxWidth.value, maxHeight.value) / (radius * 3.2f)
val hexSize = minOf(maxWidth.value, maxHeight.value) / (radius * 3.2f)
val bufferDistance = 0 //some distance between hexes optionally

val rStep = (hexSize) * sqrt(3f) + bufferDistance
val qStep = (3f / 2f) * (hexSize + bufferDistance)


for (entry in cluster.starMapEntriesSpacedOut) {


val xOffset = entry.r * rStep + (0.5f * entry.q * rStep)

val yOffset = entry.q * qStep
Expand Down Expand Up @@ -208,7 +203,7 @@ fun SpacedOutStarMapView(
}

@Composable
private fun HexagonalGrid(radius:Int) {
private fun HexagonalGrid(radius: Int) {

Canvas(modifier = Modifier.fillMaxSize()) {

Expand Down

0 comments on commit 70a0bbe

Please sign in to comment.