|Date:||24 Jul, 2016|
Based on the C# port (Christian Woltering, www.triangle.codeplex.com ) of Triangle by Jonathan Richard Shewchuk, University of California at Berkeley, www.cs.cmu.edu/~quake/triangle.html; www.lichterloh.tv
A 2d Quality Mesh Generator and Delaunay Triangulator
Triangle creates 2d delaunay triangulations of "Planar Straight Line Graphs", which basically are 2d polygons. These polygons are given by their corner points (in clockwise or counter-clockwise order).
The resulting data (2d points in structured order) can be used to create a mesh in vvvv.
Holes are supported. Fully spreadable, with helpfile(s).
All information on Triangle and Triangle.net can be found here: https://www.cs.cmu.edu/~quake/triangle.html https://triangle.codeplex.com/
All my code is MIT Triangle.net is MIT
(reminder to myself)
-file reader for *.poly files -support refining existing meshes -improve RemovRegions performance, no good -run Triangle on a different process to avoid blocking of vvvv -extrude mesh feature would be nice and not too hard to do... -png2poly
v1.3 : -fixed a bug when using unify + segments which share points -performance improvements
- now supports regions: use different meshing quality/detail for different areas and/or assign markers to distinguish regions. Helper module to remove region(s) included!
- option to unify the output, ie remove duplicate vertices and fix triangle indices/markers accordingly
- now supports defining single points and segments (lines) to make sure they are part of the final mesh
- option to shift the start-index per bin or to start at 0 for each bin
- new "Indices" output (due to the unify + shift indices options)
- new helpfiles and examples explaining the new features
- added boundary markers and smoothing
- initial release
- smoothing seems not to work in every situation, especially when using points/segments; not sure (yet) if this is due to my code or normal behaviour....
CommentsComments are no longer accepted.
Please create a new topic in the vvvv beta forum to discuss this contribution.
Very cool! Cheers
thank you needed indeed!
you're welcome! wanted to do a wrapper for the original triangle code for a while, when I found the very clean c# port the rest was a no-brainer :)
that's a coincidence, @robotanton is working on the exact same library. i wonder how the nodes differ...
aha + oje....maybe we should have some system in place to prevent double developments? btw/fyi, i'm working on implementing this www.igl.ethz.ch/projects/bbw/; and as i need triangle (+tetgen) only as inputs for that i don't mind deleting this page/plugin if robotanton's plugin is more capable (eg this one does not support regions with differing meshing quality.....); or @robotanton feel free to hijack this page ;)
oh yeah, could be interesting in combination with contour. good work.
@u7angel: true, only with rather low quality/density triangulations though, otherwise it might not be fast enough for realtime use.....
and unfortunately none of the contour nodes (neither freeframe and CV.Image) report if a contour is a hole or not :(
for the extrusion mesh to work the triangle node have to indicate if a vertex is on the edge. if I remember well the Triangle library can tell you this information. after in geometry shader you can test which 2 vertices have this tag and create a quad between them for the extrusion wall. it can be solved with a module containing GeometryBuffer and InputElements advanced (for custom semantics)
@microdee: yes indeed, that's what boundary markers are for and I just realized yesterday that they actually are very useful, especially for geometry shaders.....didn't realize yet I'd need it for extrusion too as I remembered there's a way to test it, but obviously that's much better. Will update asap to support boundary markers! As for the extrusion shader this has to wait a bit, but thanks for the input there, similar to what I had in mind, but again simpler, cheers.
I can do the extrusion in no time if we have the boundary markers ;)
cool + done! also added smoothing feature which I found while looking up boundary markers....
cool! I've checked it out and I'm currently making it a little bit more modular and exposing more data. especially neighbors, edges and stuff like that
here you go triangledx11-renderer ;)
I do understand exposing the neighbors can be useful, but I wonder when you will need the edges, isn't all the info in indexed vertices (+markers for boundary edges) already? Asking this because www.vvvv.org/contribution/tetgen also supports neighbors + edges- didn't need them yet, but it would be easy to expose there too.... looking forward to your changes :)
Neighbors are better at determining edges apparently then vertex boundary markers as "neighbor < 0 is: opposite edge is boundary". while vertex boundary markers doesn't tell you accurate edge information (like when 2 edges are lying on contour that is making all vertices to lie on contour in that case you can't find out which edges are boundary solely with vertex boundary markers)
Also you got competition ;) libtessss-+-cv.image-contour
yes, I second that, I do not have to immediately know a usecase for every input/output I expose, others might, however, there's a limit to that I believe, as it still should stay easy to use for evvvverybody, especially not intimidating for beginners. There's hidden pins, yes, but they also make sense to a certain degree only- you'd only want relatively few options to be hidden. Maybe using own datatypes and join/split (+advanced) nodes is the way to go here, keeping the main plugin easy + adding functionality as needed.....
anyways....no release no competition, hehe ;)
well true LibTessss is on github and you have to calculate neighbors yourself. https://github.com/microdee/LibTessss Triangle also generates way nicer results and tells you way much more information too. only reason I tending towards LibTess is that you don't have to indicate explicitly that a contour is a hole, it will use different "modes" to generate holes. like this:
aha, that's interesting indeed, and supposedly easier in most common cases. I'd say they serve different needs too, LibTessss I guess is a lot faster and will be the better option (less inputs) for all cases when you need to mesh any 2d area, not really caring about how it's triangulated.....like you said for some shader applications more points on the edge or inside the mesh (+more information) will be useful though; as eg for shape-aware computations too, which is what I'm working on. plus: they're beautiful :)
I added an upload to have this in pack form. Now it can conveniently go into the packs folder.
oi @dominik, what's the advantage of having it as pack version? or do you just like having both version side by side...? just found a performance leak + going to update tomorrow!
The last version from 22.10.16 is not working here, triangle node is red in any vvvv version I tried. The one before is fine
hi ain, sorry for the late reply, did not see this...please try again with the most recent upload + make sure to download the right zip (normal plugin or pack); if it still doesn't work please let me know what tty is saying....
I'm managing to crash my app with this exception. Can you explain, what's going on there? What bounds and what array is meant?
@drehwurm: out of bounds is pretty generic as it can have lots of reasons - basically it says there is some array somewhere which is smaller than the index used trying to access it; also, from the error message only you can’t tell which array is making problems.... BUT „ran out of precision“ is interesting, as it’s a Triangle.Net specific error (which I found out via google), and it points to the actual problem, see here https://github.com/eppz/Triangle.NET/blob/master/Triangle.NET/Triangle/Meshing/QualityMesher.cs Can‘t see line numbers as I’m on my mobile but simply search for ran out of precision - it looks like the triangles you are trying to create are too small for floating point precision; try decreasing the quality of your desired mesh!
very nice contrib, thx man =)