diff --git a/orx-shapes/src/main/kotlin/RegularStar.kt b/orx-shapes/src/main/kotlin/RegularStar.kt index e59e22e4..1992c49c 100644 --- a/orx-shapes/src/main/kotlin/RegularStar.kt +++ b/orx-shapes/src/main/kotlin/RegularStar.kt @@ -9,10 +9,11 @@ import kotlin.math.sin fun regularStar(points: Int, innerRadius: Double, outerRadius: Double, center: Vector2 = Vector2.ZERO, phase: Double = 0.0): ShapeContour { return contour { + val theta = Math.toRadians(phase) val phi = PI * 2.0 / (points * 2) for (i in 0 until points * 2 step 2) { - val outerPoint = Vector2(cos(i * phi), sin(i * phi)) * outerRadius + center - val innerPoint = Vector2(cos((i + 1) * phi), sin((i + 1) * phi)) * innerRadius + center + val outerPoint = Vector2(cos(i * phi + theta), sin(i * phi + theta)) * outerRadius + center + val innerPoint = Vector2(cos((i + 1) * phi + theta), sin((i + 1) * phi + theta)) * innerRadius + center moveOrLineTo(outerPoint) lineTo(innerPoint) }