Applied kotlin style conventions

This commit is contained in:
bluefireoly
2020-10-18 18:36:49 +02:00
parent e1d4e8bbfc
commit da848728d2
39 changed files with 509 additions and 385 deletions

View File

@@ -15,26 +15,22 @@ fun Structure.buildAt(loc: Location) {
}
/** @see Structure.rotate */
fun Structure.rotateAroundX(angle: Number)
= rotate(angle) { it, rad -> it.rotateAroundZ(rad) }
fun Structure.rotateAroundX(angle: Number) = rotate(angle) { it, rad -> it.rotateAroundZ(rad) }
/** @see Structure.rotate */
fun Structure.rotateAroundY(angle: Number)
= rotate(angle) { it, rad -> it.rotateAroundY(rad) }
fun Structure.rotateAroundY(angle: Number) = rotate(angle) { it, rad -> it.rotateAroundY(rad) }
/** @see Structure.rotate */
fun Structure.rotateAroundZ(angle: Number)
= rotate(angle) { it, rad -> it.rotateAroundZ(rad) }
fun Structure.rotateAroundZ(angle: Number) = rotate(angle) { it, rad -> it.rotateAroundZ(rad) }
/** @param angle The angle of rotation in degrees.*/
inline fun Structure.rotate(angle: Number, vectorRotation: (Vector, Double) -> Vector)
= Structure(
HashSet<SingleStructureData>().apply {
structureData.forEach {
this += SingleStructureData(
vectorRotation.invoke(it.location.toVector(), Math.toRadians(angle.toDouble())).toSimpleLoc(),
it.structureData
)
}
inline fun Structure.rotate(angle: Number, vectorRotation: (Vector, Double) -> Vector) = Structure(
HashSet<SingleStructureData>().apply {
structureData.forEach {
this += SingleStructureData(
vectorRotation.invoke(it.location.toVector(), Math.toRadians(angle.toDouble())).toSimpleLoc(),
it.structureData
)
}
)
}
)