Mesh generation respecting border (Beta3)

Dec 15, 2016 at 4:40 PM
Edited Dec 15, 2016 at 4:48 PM
Hi all,
I have an issue in generating mesh compliant with edge.
I have beta3 (can't switch to beta4 for many reasons).

I prepare InputGeometry with 5 points, insert the corresponding 5 segments but I don't get the expected mesh.
Following a simple sketch.

 ____
|   /
|  /
|  \      figure
|___\

 ____
|\  /
| \/
| /\      mesh expected
|/__\

 ____
|\  /|
| \/ |
| /\ |    mesh obtained
|/__\|
what am I missing?

Thanks in advance
Coordinator
Dec 15, 2016 at 6:01 PM
From what you have explained, everything should work as expected. Could you show me the code?
Dec 16, 2016 at 8:18 AM
Hi wo80,
here is the simple code I'm using for testing:
cInputGeometry = new InputGeometry();
cMesh = new Mesh();

cInputGeometry.AddPoint(0, 0);
cInputGeometry.AddPoint(10, 0);
cInputGeometry.AddPoint(5, 5);
cInputGeometry.AddPoint(10, 10);
cInputGeometry.AddPoint(0, 10);

cInputGeometry.AddSegment(0, 1, 1);
cInputGeometry.AddSegment(1, 2, 1);
cInputGeometry.AddSegment(2, 3, 1);
cInputGeometry.AddSegment(3, 4, 1);
cInputGeometry.AddSegment(4, 0, 1);

cMesh.Triangulate(cInputGeometry);
I've tried playing with segments orientation, mesh behaviour and other things but I can't solve the issue.
Thanks for the support,
Dec 16, 2016 at 9:18 AM
Hi wo80,
problem solved, it was my colleague's mistake, he has modified the code for some debugging purposes and I was using his modified .dll; after restoring the code to its original version (Beta3) everything is ok.
Sorry for having you wasting time and compliments for this good library.
Regards,
Apr 24 at 4:08 PM
Edited Apr 24 at 4:11 PM
Hello, I have a similar problem and I am not sure exactly how to solve it.
I use an InputGeometry to add points to, and then try to triangulate it with a mesh as in your example.
The only difference is that I don't have segments, because (if i understnd this correctly) my input is not a polygon
but just a collection of points.
The triangulation is fine but i get some extra (and very large) triangles around the edges as shown in the picture.
Is there a way to fix this? Am i missing some option perhaps?
Thanks in advance!

Image
Image
May 4 at 3:00 PM
Hi Humunculus,
unfortunately I cannot see the picture you uploaded, but if I understood correctly you have just a set of points and you want a triangulation for them.

Now if you want a convex triangulation, you can:
+) use property Behavior.Convex, setting it to true (on the mesh you want to triangulate)

If you want a non-convex triangulation, you can (have to):
+) define all the segments of the border of your polygon via MyGeometry.AddSegment(PointIndex1, rPointIndex2, 0), where MyGeometry is the InputGeometry you are using for preparing the triangulation
+) use property Behavior.Convex, setting it to false (on the mesh you want to triangulate)
+) use MyMesh.Triangulate(MyGeometry), where MyMesh is the Mesh you are using.

If MyGeometry.AddSegment(PointIndex1, rPointIndex2, 0) doesn't work try with MyGeometry.AddSegment(PointIndex1, rPointIndex2, 1), I don't remember the correct choice.

Regards,