moonlight-triangulation: Delaunay meshes and exact planar-region algebra.

[ deprecated, geometry, library, math, mit, program ] [ Propose Tags ] [ Report a vulnerability ]
Deprecated in favor of moonlight-planar

Delaunay and constrained Delaunay triangulation as a lawful finite-set algebra, together with exact rational planar regions, labelled common refinement, intrinsic valuations, and polygonal Minkowski morphology. A mesh is a value of its site set, so union, intersection and difference return triangulations and refinement composes after them rather than replacing them. One structure-of-arrays half-edge mesh carries the constrained and unconstrained layers. A private finite-DCEL and construction tower owns its handles, iterators, circle-sweep build, incremental edits, constraint recovery, and refinement. Public opt-in sublibraries expose the exact scalar core, Voronoi and natural-neighbour dual, bounded concurrent join interpreter, and versioned serialization surface beside the main construction facade. On GHC 9.14, a public cell-complex component interprets admitted exact cell selections for Homology and Category and lowers exact Delaunay alpha filtrations into persistent homology. Failure is values: every refusal names its witness.


[Skip to Readme]

Flags

Manual Flags

NameDescriptionDefault
warnings-as-errors

Treat compiler warnings as errors in package validation.

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 1.0.0.0, 1.0.1.0, 1.2.0.0, 1.2.0.1, 1.3.0.0, 1.3.0.2, 1.3.0.3, 1.4.0.1, 1.4.0.2, 1.4.0.3, 1.4.0.4, 1.4.0.5, 1.5.0.0
Change log CHANGELOG.md
Dependencies aeson (>=2.2 && <2.4), async (>=2.2 && <2.3), base (>=4.22 && <5), binary (>=0.8 && <0.9), bytestring (>=0.12 && <0.13), containers (>=0.8 && <0.9), deepseq (>=1.5 && <1.6), directory (>=1.3 && <1.4), filepath (>=1.4 && <1.6), moonlight-algebra (>=0.1 && <0.2), moonlight-category (>=1.1.0.0 && <1.2), moonlight-homology (>=0.1.0.2 && <0.2), moonlight-triangulation (>=1.4 && <1.5), primitive (>=0.9 && <0.10), process (>=1.6 && <1.7), tasty-bench (>=0.3 && <0.6), text (>=2.0 && <2.2), transformers (>=0.6 && <0.7), unix (>=2.8 && <2.9), vector (>=0.13 && <0.14), vector-algorithms (>=0.9 && <0.10) [details]
Tested with ghc ==9.8.4, ghc ==9.10.3, ghc ==9.12.4, ghc ==9.14.1
License MIT
Copyright (c) 2026 Blue Rose
Author Blue Rose
Maintainer rosaliafialkova@gmail.com
Uploaded by bluerose at 2026-08-28T08:33:48Z
Category Geometry, Math
Home page https://github.com/PaleRoses/moonlight
Bug tracker https://github.com/PaleRoses/moonlight/issues
Source repo head: git clone https://github.com/PaleRoses/moonlight.git(moonlight-triangulation)
this: git clone https://github.com/PaleRoses/moonlight.git(tag moonlight-triangulation-1.4.0.2)(moonlight-triangulation)
Distributions
Executables moonlight-triangulation-alpha-spade-referent, moonlight-triangulation-spade-referent, moonlight-triangulation-persistence-rose, moonlight-triangulation-category-observatory-export, moonlight-triangulation-delaunay-pictures, moonlight-triangulation-delaunay-compare, moonlight-triangulation-ffi-contract
Downloads 61 total (45 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for moonlight-triangulation-1.4.0.2

[back to package description]

moonlight-triangulation

Part of Moonlight, the sheaf-theoretic computation layer beneath Melusine and Pale Meridian.

moonlight-triangulation carries Delaunay and constrained Delaunay triangulations as a lawful finite-set algebra under canonical observation: a mesh represents its site set, a join returns a valid Delaunay representative, and the result is a triangulation again — so the operations close, compose, and fold. Operations return typed obstructions where the finite arena cannot represent a result.

Delaunay triangulation, constrained Delaunay (CDT), exact rational planar regions and labelled overlay, intrinsic valuations, polygonal Minkowski morphology, the Voronoi dual, natural-neighbour interpolation, Ruppert refinement, walk point location, convex hull, exact Shewchuk predicates, and versioned binary serialization.

Persistence rose

Animated Moonlight persistence rose: exact Delaunay alpha filtration, persistent homology, Voronoi dual, and natural-neighbour field

Open the animation directly. · Open the static vector poster. · Read the exhibit guide.

Operations

Operation Use when Inputs Result
delaunayGeometry Coordinates own the input Vector Point Geometry-only mesh / BuildError
delaunayFromCoordinates Payloads have a separate plane Defaults, points, payloads, duplicate policy BuildResult / BuildError
siteRelation Supports need exact classification Two meshes SiteRelation
union / unions Unconstrained supports must join Two meshes / mesh list Union mesh / BuildError
intersection / intersectionWith Shared support is required Two meshes; optional payload combiner Common-site mesh / BuildError
difference / symmetricDifference Left-only / exclusive support is required Source and mask / two meshes Result mesh / BuildError
constrainedDelaunay Segments author topology Defaults, positioned vertices, index pairs BuildResult / CdtError
unionConstrained / unionConstrainedWith Arbitrary constrained meshes must join Two meshes; optional payload combiner Constrained mesh / ConstrainedUnionError
extendConstrainedWith One constrained mesh owns identity Combiner, base, extension ConstrainedExtensionResult / ConstrainedUnionError
joinSeparatedConstrained Inputs are strictly x-separated Face predicate, refinement parameters, two meshes ConstrainedSeamResult / ConstrainedUnionError
refine Quality applies globally Vertex constructor, parameters, mesh RefinementResult / BuildError
refineWithinDomain Quality applies to admitted faces Vertex constructor, parameters, face set, mesh RefinementDomainResult / BuildError
faceComponents Bounded faces must descend by label Mesh, FaceId -> label [(label, FaceComponent)]
componentBoundary One component must publish as loops Mesh, FaceComponent RegionBoundary / BoundaryObstruction
overlayLayers Layers need one exact arrangement Two PlanarLayers OverlayResult / OverlayError
overlayClosedUnion / overlayClosedIntersection / overlayRegularizedDifference Boolean output may retain lower cells Two label predicates, OverlayResult ExactCellSet / OverlaySelectionError
overlaySelectedRegion Selected faces must publish as polygons Label-pair predicate, OverlayResult PlanarRegion / RegionPublicationError
cellValuations / regionValuations Intrinsic measures are required ExactCellSet / PlanarRegion PlanarValuations / ValuationError
minkowskiSum / polygonOffset Regions must add / expand Two regions / element and region Region plus receipt / MinkowskiError
erodeBy / openWith / closeWith Regularized morphology is required Structuring element, region Region plus receipt / MinkowskiError
alphaShapeContainsFace One face at one radius is enough RadiusSquared, mesh, FaceId Bool
alphaFiltration Every critical radius matters Delaunay mesh AlphaFiltration / AlphaFiltrationError
fromExactCellSet Exact cells need a generic complex view ExactCellSet DCELComplex
filteredAlphaComplex Alpha births must enter persistence AlphaFiltration Filtered chain complex / DCELError
canonicalize Numbering must ignore construction history Mesh with unit edge/face payloads Canonical mesh / BuildError

Interpret cell sets as incidence categories. · Compute persistent alpha topology.

Foreign bindings

The C ABI and its Python, TypeScript, and Rust consumers are documented in the foreign-bindings guide. It owns construction, ABI versioning, lifecycle, obstruction semantics, and consumer examples.

Algebraic contract

union is idempotent; commutativity and associativity hold after canonicalize. Structural Eq is resident equality; use siteRelation for support comparison.

Set-operation types

union :: JoinSemilattice annotation
      => Triangulation 'Unconstrained annotation () () ()
      -> Triangulation 'Unconstrained annotation () () ()
      -> Either BuildError (Triangulation 'Unconstrained annotation () () ())

unions :: JoinSemilattice annotation
       => [Triangulation 'Unconstrained annotation () () ()]
       -> Either BuildError (Triangulation 'Unconstrained annotation () () ())

siteRelation
      :: Triangulation leftMode leftAnnotation leftDirected leftUndirected leftFace
      -> Triangulation rightMode rightAnnotation rightDirected rightUndirected rightFace
      -> SiteRelation

intersection
      :: Triangulation 'Unconstrained () () () ()
      -> Triangulation 'Unconstrained () () () ()
      -> Either BuildError (Triangulation 'Unconstrained () () () ())

intersectionWith
      :: (leftAnnotation -> rightAnnotation -> annotation)
      -> Triangulation 'Unconstrained leftAnnotation () () ()
      -> Triangulation 'Unconstrained rightAnnotation () () ()
      -> Either BuildError (Triangulation 'Unconstrained annotation () () ())

difference
      :: Triangulation 'Unconstrained leftAnnotation () () ()
      -> Triangulation 'Unconstrained rightAnnotation () () ()
      -> Either BuildError (Triangulation 'Unconstrained leftAnnotation () () ())

symmetricDifference
      :: Triangulation 'Unconstrained annotation () () ()
      -> Triangulation 'Unconstrained annotation () () ()
      -> Either BuildError (Triangulation 'Unconstrained annotation () () ())

Publication schedules and scale behavior.

Use

Use the main facade with explicit Vector inputs. Construction and set algebra retain their typed obstruction in Either:

build-depends:
  base >= 4.19 && < 5,
  moonlight-triangulation >= 1.4 && < 1.5,
  vector >= 0.13 && < 0.14

SetAlgebra.hs is the smallest compile-checked workflow. The example index adds constrained interiors, alpha-boundary descent, exact overlay and valuations, and polygonal morphology.

Architecture

The resident DCEL is immutable structure-of-arrays over paged copy-on-write storage; local mutation is sealed in ST. Half-edge twins are index complements. Exact predicates use bounded machine-word evaluation and fall through to aligned Integer arithmetic when required.

Consumer libraries

The Cabal manifest owns component visibility and dependencies; this is its consumer-facing projection. External packages normally use the main library and add only the public sublibraries whose modules they import. The finite DCEL and construction kernel remain private behind the main facade.

Dependency Imports Purpose
moonlight-triangulation Moonlight.Triangulation, .HintGenerator, .Overlay, .Minkowski Construction, observations, set algebra, CDT, refinement, alpha geometry, and exact planar operations.
moonlight-triangulation:core .Scalar, .LineSideInfo Low-level exact scalars and paged storage primitives.
moonlight-triangulation:dual .Voronoi, .Voronoi.Handles, .Interpolation Voronoi observations and natural-neighbour interpolation.
moonlight-triangulation:parallel .Parallel Bounded concurrent union; adds async.
moonlight-triangulation:serialize .Serialization Versioned binary envelopes; adds binary, bytestring, and transformers.
moonlight-triangulation:cell-complex (GHC 9.14+) .CellComplex Cell, chain, and filtered-alpha interpretations; adds Homology.

Build and validate package components locally.