↓Skip to main content

Komp-Geom

What happens when two calculated points are almost, but not quite, equal? In computational geometry, that small difference can change the result of an algorithm. Komp-Geom is where I explore questions like this and build tools for working through them in Kotlin.

The project has three parts:

  • Komp-Geom is the Kotlin Multiplatform library, with geometric primitives, operations, and algorithms.
  • Komp-Geom Visualizer shows what the algorithms do, making tricky edge cases easier to investigate.
  • Komp-Geom Examples uses small Java programs to show how to work with the library.

Five purple segments and their orange intersection points in the Komp-Geom Visualizer. The algorithm tools appear on the left.
Unit tests check whether an algorithm returns the expected result. But seeing it work is more fun: here the visualizer shows the intersections found by Bentley–Ottmann in orange.

Why I am building it #

What interests me about computational geometry is how closely the algorithms and their implementation are connected. A formula alone is not enough if rounding errors change a comparison or an awkward API makes the result hard to use. I want to understand where these problems arise and build a library that feels natural to use from Kotlin.

Each part helps in a different way: I implement the algorithms in the library, inspect their behavior in the visualizer, and use the examples to see what the API feels like from an application.

What I am working on #

  • Geometric primitives in one, two, and three dimensions
  • Floating-point comparisons that account for small rounding errors
  • Algorithms such as closest pair and convex hull
  • Kotlin Multiplatform APIs with immutable structures and mutable variants for performance-sensitive cases
  • Tests, documentation, and benchmarks across supported platforms

Komp-Geom is still in development. I am adding algorithms, working on clearer visualizations, and revisiting the API when the examples reveal something awkward.

Code and demo #

Library

Komp-Geom

Source code, documentation, and tests for the Kotlin Multiplatform library.

Constantin Ponfick
Author
Constantin Ponfick
I write about software engineering, cloud development, AI-supported development, and personal projects.