# Triangulate triangle surfaces

Hi there,

I was wondering if there is node outhere that is able to automate triangulation of triangle panels as shown below (done manually in autocad). All the paneling nodes I found seem to be based on UV mapping wich obviously don’t apply on this case. I want to base paneling on edge subdivision. It the example shown below each edge was subdivided by 5.

I have an idea maybe how to develop this from scratch in Dynamo, just wondering if this has already been done.

Could you post the geometry and you have done so far?

you can use Lunch Box Package use node triangle paneling and project thee curves on your Surface.

interesting approach. I suppose I can create a 4 sided polygon per triangle as an helper in order to subdivide and project the subdivision onto it¡s respective triangle. The problem is that I’m not having much success subdividing this distorted rectange, the subdivision is not following the actual geometry:

Looks like the uvs are falling outside of the surface because ya been trimmed. Place a degree of control on your uvs and the issue should resolve itself.

hmmm not sure how to place a degree of control. Any pointers?

Subdividing one triangle …

subTriangles.dyn (11.1 KB)

``````c0 = t.Explode();
c1 = c0[0];
c2 = c1.StartPoint.DoesIntersect(c0[1])?c0[2]:c0[1];
c3 = c1.StartPoint.DoesIntersect(c0[1])?c0[1]:c0[2];
d1 = Vector.ByTwoPoints(c1.EndPoint,c2.Intersect(c3));
p1 = c1.PointAtParameter(0..1..#n+1);
d2 = List.TakeItems(0..#n+1..(c2.Length/n),1..n+1);
p3 = List.Flatten(p1<1>.Translate(d1,d2<1><2>)<1>,-1);
//Triangle Vertex Groups
p11 = List.DropItems(p3,-1);
p12 = List.DropItems(List.Sublists(List.RestOfItems(p3)<1>,0..1,1)<1>,-1);
p13 = List.Flatten(List.Transpose(List.Transpose([p11,p12])<1>)<1><2>,-1);
p14 = List.DropItems(List.DropItems(List.DropItems(p3,2)<1>,-1)<1>,1);
p15 = List.DropItems(List.Sublists(List.DropItems(p11,1)<1>,0..1,1)<1>,-1);
p16 = List.Flatten(List.Transpose(List.Transpose([p14,p15])<1>)<1><2>,-1);
p17 = List.Clean(List.Flatten(List.Transpose([p13,p16]),2),false);``````
10 Likes

Vikram, that’s exactly what i was trying to achieve.

I was trying to do this via nodes, so I will take some time to understand how your code works (if I ever understand it at all )

I converted your code into a node and maneged to apply it to a multi triangle surface. it works beautifully.

thank you very much, this will be extremely heplfull.

1 Like

@Vikram_Subbaiah I cannot open the dyn you posted . I get the following error:

Also if I copy the code:

ideas?

Narrow down which line it is in by commenting out lines // or /* for multiple.

This will make that type of error pretty clear for the most part.

1 Like

are u asking for this related woks in dynamo triangulating of surfaces like this

The above definition was done in ver 2.0
This should work in ver 1.3 …

``````//Triangle
t = Polygon.ByPoints(Autodesk.Point.ByCoordinates({3,-2,10},{0,10,8}));
//number of divisions
n = 5;

//Points
c0 = t.Explode();
c1 = c0[0];
c2 = c1.StartPoint.DoesIntersect(c0[1])?c0[2]:c0[1];
c3 = c1.StartPoint.DoesIntersect(c0[1])?c0[1]:c0[2];
d1 = Vector.ByTwoPoints(c1.EndPoint,c2.Intersect(c3));
p1 = c1.PointAtParameter(0..1..#n+1);
d2 = List.TakeItems(0..#n+1..(c2.Length/n),1..n+1);
p3 = List.Flatten(p1<1>.Translate(d1,d2<1><2>)<1>,-1);
//Triangle Vertex Groups
p11 = List.DropItems(p3,-1);
p12 = List.DropItems(List.Sublists(List.RestOfItems(p3)<1>,0..1,1)<1>,-1);
p13 = List.Flatten(List.Transpose(List.Transpose({p11,p12})<1>)<1><2>,-1);
p14 = List.DropItems(List.DropItems(List.DropItems(p3,2)<1>,-1)<1>,1);
p15 = List.DropItems(List.Sublists(List.DropItems(p11,1)<1>,0..1,1)<1>,-1);
p16 = List.Flatten(List.Transpose(List.Transpose({p14,p15})<1>)<1><2>,-1);
p17 = List.Clean(List.Flatten(List.Transpose({p13,p16}),2),false);
pgn = Polygon.ByPoints(p17);``````
1 Like