Python Forum

Full Version: Solving a pattern. Stuck...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I am currently trying to create geometries from a list of point (0-9) and need to organize the points.
The points look like this:

0
1 2
3 4 5
6 7 8 9

what i need to is create sets of triangles so i need to organize the points like this:
[0,1,2,0]
[1,3,4,1]
[1,2,4,1]
[2,4,5,2]
[3,6,7,3]
[3,4,7,3]
[4,7,8,4]
[4,5,8,4]
[5,8,9,5]

the first and last points always repeat to create a closed triangle.

Any thoughts? I made the first triangle but can't find the pattern for all the rest.
what do your attempts look like, and where do you believe the problems are located, show code.
And more explanation, please. I don't understand how the triangles related to the four item lists.