[orxy-shape] Optimize list initialization with predefined capacity in HobbyCurve.kt

This commit is contained in:
Edwin Jakobs
2025-02-02 11:41:19 +01:00
parent 64ac42913c
commit 75bba098a2

View File

@@ -109,8 +109,8 @@ fun hobbyCurve(points: List<Vector2>, closed: Boolean = false, curl: Double = 0.
}
}
val c1s = mutableListOf<Vector2>()
val c2s = mutableListOf<Vector2>()
val c1s = ArrayList<Vector2>(n)
val c2s = ArrayList<Vector2>(n)
for (i in 0 until n) {
val v1 = rotateAngle(chords[i], alpha[i]).normalized
val v2 = rotateAngle(chords[i], -beta[i]).normalized
@@ -205,8 +205,8 @@ fun hobbyCurve(
}
}
val c1s = mutableListOf<Vector3>()
val c2s = mutableListOf<Vector3>()
val c1s = ArrayList<Vector3>(n)
val c2s = ArrayList<Vector3>(n)
for (i in 0 until n) {
val r1 = buildTransform { rotate(normals[i], alpha[i].asDegrees) }
val r2 = buildTransform { rotate(normals[(i + 1).mod(normals.size)], -beta[i].asDegrees) }