# Filling pentagon with quads (combinatorics)

How to subdivide edges of the pentagon so that when I'm making grid with faces I get perfect quads or almost all quads ?

This is more math-combinatorics question but is quite important for the mesh to have nice grid.

For example, if I press grid fill with this subdivion, Blender says to select two edge loops and I can't fill it with almost all quads.

• GridFill will work on even number of vertices, so e.g. pentagon of 5 verts subdivided once. This won't provide decent topology though in this case (at least with one click) so using Cathmull-Clark way seems to be the most efficient one here. – Mr Zak Jun 21 '17 at 14:37

If you look at how the Catmull-Clark subdivision algorithm does it, you can see it creates a five-pointed star:

Before:

After:

When you surround it with quad geometry, it still works the same:

Before:

After:

With Catmull-Clark smoothing:

If we look at this, we can see that this redirects the topology very nicely:

It is important to note, though, that in a few cases, you can change the way you divide it up to change the topological flow. Most times though, this is the easiest and most useful subdivision.

# Edit:

When I saw your edit and understood better what you were asking, the first thing I thought of was CGCookie's Retopoflow addon. You can purchase it on the Blender Market. This has a few algorithms to fill or "patch" areas like that. I looked at how it did that and came up with a few ideas:

### #1: Are all of your subdivisions necessary?

I know that this doesn't answer your question directly, but it seems like the number one thing that the RetopoFlow does is reevaluate whether all of the vertices on each edge are necessary. It will add or remove vertices to adjust and produce cleaner topology.

### #2: Treat it like a quad

In some cases, you can treat it like a quadrilateral. For example, if you have a pentagon like this:

You can treat the two right edges as one edge and still fill it like a quad:

It doesn't have to be symmetrical:

In addition, Retopoflow has a open pull request that has more sophisticated N-gon filling methods. You might be able to look through the source code to find what algorithms it uses. Here is a gif from the site of what this produces:

• Thanks for this explanation but I was wondering about filling the pentagon with different subdivisions of edges and making a perfect quad fill. I want to have edges subivided in edit mode and then fill it with faces. – Wildfire Jun 21 '17 at 12:46
• @Wildfire Does this answer your question better? – Scott Milner Jun 22 '17 at 2:19
• Yes it does. Thanks. In #2: Treat it like a quad? you made pentagon with edge subdivision 4,3,2 . Is there underlying matematics what numbers to take to get such quad subdivision. I'.ll take a look at this addon you mentioned but is for retopology, right? It a expensive for my hobby. – Wildfire Jun 22 '17 at 10:37
• @Wildfire. Treat it like a quad, meaning that you treat two of the edges as one, bent edge. Buying RetopoFlow is expensive, and the money goes to support its development, but since it makes Blender API calls, it is still open source and you can legally download it for free on the GitHub link I gave without paying. – Scott Milner Jun 22 '17 at 15:59