This project is read-only.

Points close to contour or other points

Jun 23, 2016 at 2:19 PM

I have a small problem using Triangle.NET in my solution. Here is the problem:

Let's say that you have contour that is shaped like a triangle. I add the contour using the polygon.Add(new Contour....-method. Afterward I want to add a Vertex that is on the contour. Since the point is calculated using double precision I can easily get an infinite when trying to triangle my mesh (the point will then be extremely close to the contour, but not exactly on it).

This can also happen with points that are very close to eachother.

So my question: Is there any way to say that points that are really close to a contour or other points should be handled as one point?

Best regards
Jun 24, 2016 at 1:19 PM
Edited Jun 24, 2016 at 1:20 PM
I don't think Triangle will handle this kind of situation well. It's basically a setup described on :

Strange things can happen if you've taken liberties with your PSLG. Do you have a vertex lying in the middle of a segment? Triangle sometimes copes poorly with that sort of thing. Do you want to lay out a collinear row of evenly spaced, segment-connected vertices? Have you simply defined one long segment connecting the leftmost vertex to the rightmost vertex, and a bunch of vertices lying along it? This method occasionally works, especially with horizontal and vertical lines, but often it doesn't, and you'll have to connect each adjacent pair of vertices with a separate segment. If you don't like it, tough.

Currently there's no easy way to update a mesh in the way you describe it and Triangle is really not made for this.
Jun 24, 2016 at 1:36 PM
Thank you very much for a quick answer. I had a feeling that Triangle.NET didn't support this, but I had to be sure before I started on the work around.

Thanks again for the answer and a great framework!

Best regards,