jDistMesh

April 3, 2026 ยท View on GitHub

License: MIT Kotlin

jDistMesh is a Kotlin implementation of DistMesh โ€“ a simple generator of unstructured triangular meshes.

Originally developed as a Java port for a diploma thesis at CTU FEL, this version has been modernized to Kotlin and uses Gradle for build management.

๐Ÿš€ Quick Start

Prerequisites

  • JDK 21 or newer

Build and Run

To launch the GUI viewer:

./gradlew run

To run tests:

./gradlew test

โœจ Features

  • 2D Mesh Generation: Pure Kotlin implementation of the DistMesh2D algorithm.
  • Interactive Viewer: GUI for visualizing the triangulation process in real-time.
  • Scripting Support: Ability to define mesh parameters (distance functions, edge length functions) using Kotlin Scripts (.main.kts).
  • Delaunay Triangulation: Includes a custom 2D Delaunay implementation.

๐Ÿ“‚ Project Structure

  • src/main/kotlin: Core algorithm and GUI viewer.
  • src/main/scripts: Example mesh definitions using Kotlin Script.
  • src/main/matlab: Original MATLAB implementation for reference.

๐Ÿ›  Scripting Interface

The application can execute external scripts to define complex geometries. Example scripts can be found in src/main/scripts/.

๐Ÿ“œ License

This project is licensed under the MIT License. See LICENSE.txt for details.

๐Ÿ™ Acknowledgments

This project is a port of the original DistMesh by Per-Olof Persson and Gilbert Strang.