• Home
  • Documentation
  • Forum
  • Blog
  • Users
    • Map
    • Userlist
    • Businesses
    • Userpages
    • Connections
  • Contributions
    • All
    • Store
  • Downloads
    • vvvv beta
    • vvvv beta previews
  • Store
Show / Hide Table of Contents

Triangle

Author: digitalwannabe
Date: 24 Jul, 2016
Category: 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

Download

64bit

5-2DTriangle_pack_b34.2_AnyCPU_v1.3.zip
30 Jan, 2017 - 23:40
v1.3: bugfix for segments which share points, peformance improvements
4-2DTriangle_b34.2_AnyCPU_v1.3.zip
30 Jan, 2017 - 23:41
v1.3: bugfix for segments which share points, peformance improvements
3-2DTriangle_pack_b34.2_AnyCPU_v1.2.zip
21 Oct, 2016 - 22:04
Now in pack form
2-2DTriangle_b34.2_AnyCPU_v1.2.zip
13 Oct, 2016 - 15:31
region support, remove regions, unify output, point/segment support, indices out, new examples
1-2dTriangle_b34.2_AnyCPU_v1.1.zip
29 Jul, 2016 - 00:36
added boundary markers and smoothing
0-2dTriangle_b34.2_AnyCPU.zip
24 Jul, 2016 - 16:33
initial

Description

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:

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

Comments

Comments are no longer accepted.
Please create a new topic in the vvvv beta forum to discuss this contribution.
everyoneishappy
24 Jul, 2016 - 17:13

Very cool! Cheers

io
24 Jul, 2016 - 18:21

thank you needed indeed!

digitalwannabe
24 Jul, 2016 - 19: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 Jul, 2016 - 20:04

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

digitalwannabe
24 Jul, 2016 - 21: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 Jul, 2016 - 17:04

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

digitalwannabe
28 Jul, 2016 - 12:02

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

microdee
28 Jul, 2016 - 13: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 Jul, 2016 - 15: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 Jul, 2016 - 19:38

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

digitalwannabe
29 Jul, 2016 - 00:01

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

microdee
29 Jul, 2016 - 15: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 Jul, 2016 - 11:59

yeah!

digitalwannabe
30 Jul, 2016 - 16: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 Jul, 2016 - 13: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 Aug, 2016 - 11: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 Aug, 2016 - 11: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 Aug, 2016 - 12: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 Oct, 2016 - 22:06

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

digitalwannabe
30 Oct, 2016 - 03: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 Jan, 2017 - 17: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
30 Jan, 2017 - 23: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 Jan, 2019 - 21: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 Jan, 2019 - 22: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 Jan, 2019 - 14:13

very nice contrib, thx man =)

  • Improve this Doc

© 2020 by vvvv group. Imprint | Privacy Policy.
Thanks to DocFX for building this website. Analytics by Plausible.

Back to top