artem-ogre / CDT

Constrained Delaunay Triangulation (C++)
https://artem-ogre.github.io/CDT/
Mozilla Public License 2.0
1.07k stars 133 forks source link

Question on a constrained Delaunay triangulation with intersecting edges #95

Closed stla closed 2 years ago

stla commented 2 years ago

Hello,

I inputted the four vertices of a square as vertices and the two diagonals of this square as constraint edges. Then the output I got is the triangulation with no triangle, no edge, and four fixed edges: the segments which join the center of the square to the vertices. Is it normal? I expected to get four triangles.

artem-ogre commented 2 years ago

It could be normal depending on how does the code look like. Can you show the code?

stla commented 2 years ago

My code is a bit special because I call it from Haskell. Here are the main points:

  ......
  CDT::Triangulation<double> cdt(
    CDT::VertexInsertionOrder::AsProvided,
    CDT::IntersectingConstraintEdges::Resolve,
    0.0
  );
  ......
  cdt.insertVertices(vertices);
  cdt.insertEdges(Edges);
  cdt.eraseOuterTrianglesAndHoles();
  ......
artem-ogre commented 2 years ago

Oh, nice! Are there Haskell bindings? :)

Your output is normal:

Hope it clears the things.

stla commented 2 years ago

Thanks, I didn't know pieceToOriginals, I will look at that.

I am the author of the Haskell bindings. I started two days ago: https://github.com/stla/hcdt. I have not mentioned your name and the license yet, I will do.