Triangulation modelling problem


I’ve hit a difficulty when doing face triangulation. I made some voronoi cells which are almost all n-gons (more than 4-gons). The pattern was generated using voronoi plugin, basing on some c-points scattered randomly onto a face. Now I want to triangulate automatically each face, so that all its vertices are connected to the c-point that lays onto the face.
I tried Fredo’s Face Triangulator (Fredo tools) and it does respcet existing c-point but doesn’t connect it to each face vertex.

In short:

My input is 1.
What I’m getting from Face Triangulator is 2.
What I want is 3.

And I want it for multiple faces at once.

I guess it could be a simple script but I can’t write scripts.

Any help appreciated.

voronoi excerpt.skp (173.7 KB)

You can triangulate yourself by drawing edges between each face vertex and the face center.

Ya, I know, it’s manual approach but I’m searching for some automation.

Use the “Flip” (on diagonal) in the ‘Sandbox’ toolset. It’s Just a few edges that need flipping.

Right but for a bigger matrix I’m planning on it’s not that little work.

Most triangulation algorithms are going to give you non-optimal triangulation (from your perspective), as you show in your example. The edges you don’t want are actually preferred by the algorithm because they are shorter and make triangles that aren’t as long and skinny. What is your ultimate goal with this project?

1 Like

I ultimately want to raise the c-point vertices up and create a turtle-like shell elevation for a building. With further steps I will manage. Just wondering how to do triangulation. Not the most “optimal” one but kind of “face vertex to c-point” triangulation. In the picture the elevated verts are former c-points.

semi-automatically + invert selection (SU2020) you’ll have elevated verts.

1 Like

This can be quite simply achieved by scripting by I don’t know how much you are into Ruby and the SketchUp API. If you select a construction point and a face you can run this snippet in the Ruby Console.

face = Sketchup.active_model.selection.grep(Sketchup::Face).first
cpoint = Sketchup.active_model.selection.grep(Sketchup::ConstructionPoint).first

face.vertices.each do |vertex|
  Sketchup.active_model.entities.add_edges(vertex.position, cpoint.position)

Nice :smiley: This can definitely make things faster. I didn’t think about Vertex Tools!

Thank you for the code. It works perfect but… only for a single face. I have entire voronoi matrix and it’s just a small test matrix. The code would have to determine a certain c-point that touches a cetrain face and then triangulate that face regarding that particular c-point. Then repeat will all pairs found in the selection (when entire matrix is selected).
I’m just talking generally because I can’t code at all. I’m aware that such code would be quite more complex.