Bug with Smooth function?

Feb 26, 2013 at 3:59 PM
Using the latest changeset i have detected bug in Otri.cs file next function:
    /// <summary>
    /// Origin [org(abc) -> a]
    /// </summary>
    public Vertex Org()
    {
        return triangle.vertices[plus1Mod3[orient]];
    }
after calling mesh.Smooth() gets NullReferenceException, cause triangle is null.
Please, help me. How can i circumvent this bug?
Coordinator
Feb 27, 2013 at 8:56 AM
Edited Feb 27, 2013 at 5:26 PM
Could you save your mesh before smoothing and send it to [ deleted ]

If you are using the Mesh Explorer app, just use the save option from the menu. Otherwise do
TriangleFormat format = new TriangleFormat();
format.Write(mesh, filename);
Send both .poly and .ele files.
Coordinator
Feb 27, 2013 at 5:23 PM
Edited Feb 27, 2013 at 5:28 PM
Thanks for the mails. Triangle.NET has some built in checks for duplicate input vertices. To enable logging, you could do
Behavior.Verbose = true;

mesh.Triangulate(...);

var log = SimpleLog.Instance.Data;
// log will now contain warnings if duplicate vertices were found
It's also a good idea to check the mesh for errors:
bool isConsistent, isDelaunay;
mesh.Check(out isConsistent, out isDelaunay);
If any errors are found, the log will contain further information.

The exception is thrown in the BoundedVoronoi class. Since the duplicate vertex is not connected to any triangle, there's no way building a Voronoi cell for it.
Feb 27, 2013 at 5:34 PM
Edited Feb 27, 2013 at 5:35 PM
Dear Wo80,
First of all, let me express my very sincere and cordial thanks for sharing your work, and also your updates and prompt responses. I recently found you, and I really appreciate it. A quick question: I assume that it is possible to have an array of the triangles (maybe a new class) where we can have each triangles centroid, area, and maybe some properties like rendering fillcolor that can later be associated with a specific state for that triangle when used in another application.
Just wanted to know if it is already there and I am overlooking it, or if not, your suggestion for the most efficient way to doing that (using your existing Trinagle, and Rendering programs). I am familiar with c# (and programming) so, feel free to have a short answer. I do not want to waste your time.

Thank you again for the good work!

By teh way, forgive me for not starting a new thread.
Coordinator
Feb 27, 2013 at 5:58 PM
Edited Feb 27, 2013 at 6:00 PM
@esmaeily
Nothing built in, but should be pretty straight forward to implement. Just loop over the mesh.Triangles collection and store the values you need (triangle coordinates, area, centroid, color ...).

EDIT: triangle area is calculated in QualityMeasure.cs
Feb 27, 2013 at 7:11 PM
Dear Wo80,
First of all, let me express my very sincere and cordial thanks for sharing your work, and also your updates and prompt responses. I recently found you, and I really appreciate it. A quick question: I assume that it is possible to have an array of the triangles (maybe a new class) where we can have each triangles centroid, area, and maybe some properties like rendering fillcolor that can later be associated with a specific state for that triangle when used in another application.
Just wanted to know if it is already there and I am overlooking it, or if not, your suggestion for the most efficient way to doing that (using your existing Trinagle, and Rendering programs). I am familiar with c# (and programming) so, feel free to have a short answer. I do not want to waste your time.

Thank you again for the good work!