Closed EricBeetsOfficial-Opuscope closed 6 months ago
Hi!
I just updated the demo/test app at https://github.com/iShapeUnity/TriangulationDebug, and I added a Tesselletion scene with some tests.
It's much easier to see it once than to explain it.
Here's a short code snippet to understand how to work with it:
var iGeom = IntGeom.DefGeom;
var pShape = TriangulationTests.Data[index].ToPlainShape(iGeom, Allocator.Temp);
// extraPoints it's just a point inside your shape, you can think about it like a super small hole which contain just one point
var extraPoints = new NativeArray<IntVector>(0, Allocator.Temp);
// delaunay is data which represent our triangulation by default it's just simple triangulation without additional spliting
// here I also pass a parameter maxEdge, it will split any edge if it length more then this one
var delaunay = pShape.Delaunay(iGeom.Int(maxEdge), extraPoints, Allocator.Temp);
// split our triangulation more and use a rule with a max triangle are. If base triangulation contain a triangle more then this area it will be splitted
delaunay.Tessellate(iGeom, maxArea);
extraPoints.Dispose();
// get indices for mesh
var triangles = delaunay.Indices(Allocator.Temp);
// get vertices for mesh, 0 is z value
var vertices = delaunay.Vertices(Allocator.Temp, iGeom, 0);
delaunay.Dispose();
here you can see how maxArea and maxEdge affect triangulation
hope this help
Thank you for your quick reply !
I thought extraPoints
was the manually added points to the tessellation, it's clearer now.
My next step is to run it into a Job ;)
Thanks again !
About running into a Job. It's super easy. Here you can take and adjust my job: https://github.com/iShapeUnity/TriangulationDebug/blob/main/Assets/Source/TriangulationJob.cs
I would also need the Clipper repo, but it isn't updated on the Geometry package 0.0.5 :p
Clipper is not in production. It has some bugs.
Right now I am working on my second generation of this libraries;
It will be triagulation and poly bool library.
I've alredy finished them for Swift.
And ported in Rust.
https://github.com/iShape-Swift/iOverlay
After that I am going to port them in Unity too. So they will be ready soon. May be month or more
oh, ok thank you for your help !!
Hi there !
I not sure to understand how I can use the tessellation feature (adding points). Is there any sample about it ?
Thanks for your great job ! Eric