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

Triangle

plugin delaunay 2d delaunay triangulate mesh generator
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 - 18:13

Very cool! Cheers

io 24/07/2016 - 19:21

thank you needed indeed!

digitalwannabe 24/07/2016 - 20: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 - 21:04

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

digitalwannabe 24/07/2016 - 22: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 - 18:04

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

digitalwannabe 28/07/2016 - 13: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 - 14: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 - 16: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 - 20:38

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

digitalwannabe 29/07/2016 - 01:01

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

microdee 29/07/2016 - 16: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 - 12:59

yeah!

digitalwannabe 30/07/2016 - 17: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 - 14: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 - 12: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 - 12: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 - 13: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 21/10/2016 - 23:06

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

digitalwannabe 30/10/2016 - 04: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 - 18: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 - 00: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 - 22: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 06/01/2019 - 23: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 - 15:13

very nice contrib, thx man =)

anonymous user login

Shoutbox

~7d ago

auralscapes: By the way, if anyone would like to use any of my tracks or even parts thereof you are welcome. No fee. jerome@auralscapes.com

~7d ago

auralscapes: Thx for the advice. Much appreciated.

~7d ago

tonfilm: @auralscapes you can contact the author @dottore and ask him for the conditions.

~7d ago

auralscapes: A question for the group. I came across an application called Partitura. Is this app commercially available?

~8d ago

auralscapes: Don't have a clue how this all works but it is going to be an interesting journey indeed.

~11d ago

tonfilm: @all #vl now also has pin groups! vl-input-and-output-pin-groups #vvvv #creativecoding #visualprogramming #dotnet

~12d ago

evvvvil: Hey, broski, check my shader "The gamma ray feast" it goes bang and is commented with bad to mediocre jokes. https://www.shadertoy.com/view/wssXWl

~14d ago

hrovac: someone at b-seite on saturday?