» Triangle
This site relies heavily on Javascript. You should enable it if you want the full experience. Learn more.

Triangle

plugin
Credits: 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

about

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/

   

Source Code:

https://github.com/digitalwannabe/vvvv-sdk/tree/develop/vvvv45/addonpack/src/nodes/plugins/2d/2dTriangle

   

Licenses:

All my code is MIT
Triangle.net is MIT

  

ToDo:

(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
          
     

Changelog:

v1.3 :

  • fixed a bug when using unify + segments which share points
  • performance improvements

v1.2 :

  • 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

v1.1 :

  • added boundary markers and smoothing

v1.0 :

  • initial release
   
   

known bugs:

everyoneishappy 24/07/2016 - 19:13

Very cool! Cheers

io 24/07/2016 - 20:21

thank you needed indeed!

digitalwannabe 24/07/2016 - 21:44

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 :)

tonfilm 24/07/2016 - 22:04

that's a coincidence, @robotanton is working on the exact same library. i wonder how the nodes differ...

digitalwannabe 24/07/2016 - 23:30

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 ;)

u7angel 25/07/2016 - 19:04

oh yeah, could be interesting in combination with contour. good work.

digitalwannabe 28/07/2016 - 14:02

@u7angel: true, only with rather low quality/density triangulations though, otherwise it might not be fast enough for realtime use.....

microdee 28/07/2016 - 15:01

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)

digitalwannabe 28/07/2016 - 17:27

@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.

microdee 28/07/2016 - 21:38

I can do the extrusion in no time if we have the boundary markers ;)

digitalwannabe 29/07/2016 - 02:01

cool + done!
also added smoothing feature which I found while looking up boundary markers....

microdee 29/07/2016 - 17:07

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 ;)

digitalwannabe 30/07/2016 - 13:59

yeah!

digitalwannabe 30/07/2016 - 18:50

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 :)

microdee 31/07/2016 - 15:56

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)

+ neighbors can help find smooth normals for the extrusion bevels. For Tetgen neighbors might be used on physics to simulate soft bodies, or do stress simulations. My rule of thumb in this situations are even if I don't immediately know a use case for a data it worth exposing it because someone else might know a use case I have absolutely no knowledge about.

Also you got competition ;) libtessss-+-cv.image-contour

digitalwannabe 02/08/2016 - 13:18

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 ;)

microdee 02/08/2016 - 13:42

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:

title
digitalwannabe 02/08/2016 - 14:58

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 :)

dominikKoller 22/10/2016 - 00:06

I added an upload to have this in pack form. Now it can conveniently go into the packs folder.

digitalwannabe 30/10/2016 - 05:25

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!

ain 04/01/2017 - 19:39

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

digitalwannabe 31/01/2017 - 01:45

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....

drehwurm 06/01/2019 - 23:38

@digitalwannabe

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?

digitalwannabe 07/01/2019 - 00:32

@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!

schlonzo 16/01/2019 - 16:13

very nice contrib, thx man =)

anonymous user login

Shoutbox

~3d ago

joreg: vvvvTv S02E01 is out: Buttons & Sliders with Dear ImGui: https://www.youtube.com/live/PuuTilbqd9w

~9d ago

joreg: vvvvTv S02E00 is out: Sensors & Servos with Arduino: https://visualprogramming.net/blog/2024/vvvvtv-is-back-with-season-2/

~10d ago

fleg: hey there! What's the best tool for remote work? Teamviewer feels terrible. Thanks!

~23d ago

joreg: Last call: 6-session vvvv beginner course starting November 4: https://thenodeinstitute.org/courses/ws24-5-vvvv-beginners-part-i/

~1mth ago

joreg: Missed the last meetup? You can rewatch it here: https://www.youtube.com/live/MdvTa58uxB0?si=Fwi-9hHoCmo794Ag

~1mth ago

theurbankind: When is the next big event, like node festival ?

~1mth ago

~1mth ago

joreg: Join us for the next vvvv meetup on Oktober 17th: https://visualprogramming.net/blog/2024/25.-vvvv-worldwide-meetup/

~2mth ago

joreg: 6 session beginner course part 2 "Deep Dive" starts January 13th: https://thenodeinstitute.org/courses/ws24-5-vvvv-beginners-part-ii/