Skip to content

StefanOltmann/polybool-kotlin

Repository files navigation

polybool-kotlin

Kotlin License: MIT JVM Android iOS Windows Linux macOS JS WASM GitHub Sponsors

This is a Kotlin Multiplatform port of polybool-java / polybooljs.

For instructions on how to use polybool-kotlin, please see the original project's README as well as the unit tests.

What is PolyBool?

PolyBool is a library for performing boolean operations on 2D polygons - union, intersection, difference, and XOR.

I use it personally to optimize vector paths of Oxygen Not Included maps. By efficiently combining and simplifying complex shapes, it helps reduce map complexity and save space, making the data easier to work with and more efficient for further processing.

Installation

It's available on Maven Central.

implementation("de.stefan-oltmann:polybool-kotlin:0.1.1")

State

The code is functional, though not especially elegant.

It was largely produced using IntelliJ IDEA’s conversion tool, followed by significant manual cleanup. There is still work to do. Handling of nullable types, in particular, remains incomplete.

Currently, the only unit test, PolyBoolTest, acts as a regression check against the original polybool-java library. For validation, 10k maps from the game Oxygen Not Included are used, and they convert identically to how they do with the original polybool-java library.

Contributions

Contributions to polybool-kotlin are welcome! If you encounter any issues, have suggestions for improvements, or would like to contribute new features, please feel free to submit a pull request.

Acknowledgements

License

This project is licensed under the same license as polybool-java & polybooljs, which is the MIT license.

See the LICENSE file for more information.

About

Kotlin Multiplatform port of polybool-java

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Languages