How to initialize a 2d list of point3d to create a grid quad mesh

Hi,
I am creating a plugin for grasshopper using C# and I need to initialize and the modify a list of points as vertices of a quad mesh. I have done it before, using only List. But strangely, can’t find a convenient way to define a 2D list of point3ds.

You will need to transfer it to a 1d list while keeping the 2d structure… bcz at the end of the day, you will need a single list of vertices with a respective list of faces (each face referring to one of the vertices) to create your mesh. I am not sure if there is a ready method to do so, not to my knowledge at least.
So if you have grid of ‘m’ in the first direction, and ‘k’ in the second direction, you make your 2d list into a 1d list.
your list of verticies ‘list1d’ will be:
for(i < m){
for (j<k){
list1d.add(list2d[i][j])
}
}

Iterating through each vertex index ‘i’, your mesh face will be something like ( i , i+1 , i+k+1 , i+k )

1 Like

Thank you Heba for the answer.
Actually, this is exactly what I’ve done so far. I was looking for a more efficient way of doing it. Because I have a lot of computations on the vertices in different orders and some conditions exclusively on the boundary vertices. Indexing in this situation could become a nightmare sometimes.