Divide quad mesh

Hi guys, I am looking for methods to implement quad subdivision in grasshopper C#.

I am working on a mesh growth model, but with very strict limitations to faces size, number of edges, planarity etc. because every face will be a unit in fabrication model. I need methods to split chosen quad faces - to split them in half (in other words, to create two rectangles from one square) or to split a quad in its center to form four quads.

i know MeshTopologyEdgeList.CollapseEdge and SplitEdge methods, but as far as I know they split every quad to triangles. I tried to split two symetrical edges of a chosen face at one ireration time but after every splitting all the topology changes for vertices (meaning: they change indexes) and i dont know how to do that.

anyone knows the way?

My way will be to duplicate the mesh and use the old for the topology and the new for storing new vertices and new faces

can you explain in a more detailed way how to do it to split a quad into quads? or maybe show some examples?

What would you like to happen with the neighboring quads?

And how do you make the decision on how the rectangles are oriented?

First of all, to start, i would like them to split and grow in one direaction. Like a mesh tube. Naked edges on one side of the tube will grow based on some agent behaviour (agents = naked vertices) and after some length of the quad it will be splitted in two.

can you elaborate how you do it? or show some examples?

You could look inside Mesh Iso splitting script

There are lots of other script that takes a mesh and change it. Mesh+ weaverbird Yellow not sure they are open source. You can also search for algorithm doing recursion on mesh (fractals) …
Look at the sphere script

As a mesh is vertices and topology you must find a strategy to keep track of that.