hcdt: 2d Delaunay triangulation

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

This library performs the constrained or unconstrained 2d Delaunay triangulation.

It uses the C++ library CDT.

For examples, look the README file.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5, 0.1.1.0, 0.1.1.1
Change log None available
Dependencies base (>=4.7 && <5), containers (>=0.6.4.1 && <0.7), indexed-traversable (>=0.1.2 && <0.2) [details]
License BSD-3-Clause
Copyright 2022 Stéphane Laurent
Author Stéphane Laurent
Maintainer laurent_step@outlook.fr
Category Geometry
Home page https://github.com/githubuser/hcdt#readme
Source repo head: git clone https://github.com/githubuser/hcdt
Uploaded by stla at 2022-07-22T18:38:19Z

Modules

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for hcdt-0.1.0.0

[back to package description]

hcdt

Delaunay triangulation

ghci> import Text.Show.Pretty
ghci> import Geometry.HCDT
ghci> vertices = [Vertex 0 0, Vertex 0 1, Vertex 1 1, Vertex 1 0]
ghci> triangulation <- delaunay vertices
ghci> pPrint triangulation
Triangulation
  { _vertices =
      fromList
        [ ( 0 , Vertex 0.0 0.0 )
        , ( 1 , Vertex 0.0 1.0 )
        , ( 2 , Vertex 1.0 1.0 )
        , ( 3 , Vertex 1.0 0.0 )
        ]
  , _triangles = [ Triangle 1 0 2 , Triangle 2 0 3 ]
  , _edges = [ Edge 2 3 , Edge 0 3 , Edge 1 2 , Edge 0 2 , Edge 0 1 ]
  }
ghci> pPrint $ borderEdges triangulation
fromList [ Edge 1 0 , Edge 1 2 , Edge 0 3 , Edge 2 3 ]

Constrained Delaunay triangulation

ghci> import Text.Show.Pretty
ghci> import Geometry.HCDT
ghci> vertices = [Vertex 1 1, Vertex 3 1, Vertex 2 2, Vertex 0 0, Vertex 4 0, Vertex 2 5]
ghci> edges = [Edge 0 1, Edge 0 2, Edge 1 2, Edge 3 4, Edge 3 5, Edge 4 5]
ghci> triangulation <- cdelaunay vertices edges
ntriangles: 6
ghci> pPrint triangulation
ConstrainedTriangulation
  { _triangulation =
      Triangulation
        { _vertices =
            fromList
              [ ( 0 , Vertex 1.0 1.0 )
              , ( 1 , Vertex 3.0 1.0 )
              , ( 2 , Vertex 2.0 2.0 )
              , ( 3 , Vertex 0.0 0.0 )
              , ( 4 , Vertex 4.0 0.0 )
              , ( 5 , Vertex 2.0 5.0 )
              ]
        , _triangles =
            [ Triangle 1 0 3
            , Triangle 2 1 5
            , Triangle 2 5 0
            , Triangle 0 5 3
            , Triangle 1 4 5
            , Triangle 1 3 4
            ]
        , _edges =
            [ Edge 3 4
            , Edge 1 4
            , Edge 3 5
            , Edge 0 5
            , Edge 2 5
            , Edge 0 2
            , Edge 1 5
            , Edge 1 2
            , Edge 1 3
            , Edge 4 5
            , Edge 0 3
            , Edge 0 1
            ]
        }
  , _fixedEdges =
      [ Edge 0 1 , Edge 0 2 , Edge 4 5 , Edge 1 2 , Edge 3 4 , Edge 3 5 ]
  }