Implement the Catmull-Clark surface subdivision ([[wp:Catmull–Clark_subdivision_surface|description on Wikipedia]]), which is an algorithm that maps from a surface (described as a set of points and a set of polygons with vertices at those points) to another more refined surface. The resulting surface will always consist of a mesh of quadrilaterals.

The process for computing the new locations of the points works as follows when the surface is free of holes:
[[Image:CatmullClark_subdiv_0.png|thumb|Starting cubic mesh; the meshes below are derived from this.]]
[[Image:CatmullClark_subdiv_1.png|thumb|After one round of the Catmull-Clark algorithm applied to a cubic mesh.]]
[[Image:CatmullClark_subdiv_2.png|thumb|After two rounds of the Catmull-Clark algorithm. As can be seen, this is converging to a surface that looks nearly spherical.]]
# for each face, a ''face point'' is created which is the average of all the points of the face.
# for each edge, an ''edge point'' is created which is the average between the center of the edge and the center of the segment made with the face points of the two adjacent faces.
# for each vertex point, its coordinates are updated from (<tt>new_coords</tt>):
## the old coordinates (<tt>old_coords</tt>),
## the average of the face points of the faces the point belongs to (<tt>avg_face_points</tt>),
## the average of the centers of edges the point belongs to (<tt>avg_mid_edges</tt>),
## how many faces a point belongs to (<tt>n</tt>), then use this formula:
      m<sub>1</sub> = (n - 3) / n
      m<sub>2</sub> = 1 / n
      m<sub>3</sub> = 2 / n
      new_coords = (m<sub>1</sub> * old_coords)
                 + (m<sub>2</sub> * avg_face_points)
                 + (m<sub>3</sub> * avg_mid_edges)

Then each face is replaced by new faces made with the new points,
* for a triangle face (a,b,c):
    (a, edge_point<sub>ab</sub>, face_point<sub>abc</sub>, edge_point<sub>ca</sub>)
    (b, edge_point<sub>bc</sub>, face_point<sub>abc</sub>, edge_point<sub>ab</sub>)
    (c, edge_point<sub>ca</sub>, face_point<sub>abc</sub>, edge_point<sub>bc</sub>)
* for a quad face (a,b,c,d):
    (a, edge_point<sub>ab</sub>, face_point<sub>abcd</sub>, edge_point<sub>da</sub>)
    (b, edge_point<sub>bc</sub>, face_point<sub>abcd</sub>, edge_point<sub>ab</sub>)
    (c, edge_point<sub>cd</sub>, face_point<sub>abcd</sub>, edge_point<sub>bc</sub>)
    (d, edge_point<sub>da</sub>, face_point<sub>abcd</sub>, edge_point<sub>cd</sub>)

When there is a hole, we can detect it as follows:
* an edge is the border of a hole if it belongs to only one face,
* a point is on the border of a hole if <tt>n<sub>faces</sub> != n<sub>edges</sub></tt> with <tt>n<sub>faces</sub></tt> the number of faces the point belongs to, and <tt>n<sub>edges</sub></tt> the number of edges a point belongs to.

On the border of a hole the subdivision occurs as follows:
# for the edges that are on the border of a hole, the edge point is just the middle of the edge.
# for the vertex points that are on the border of a hole, the new coordinates are calculated as follows:
## in all the edges the point belongs to, only take in account the middles of the edges that are on the border of the hole
## calculate the average between these points (on the hole boundary) and the old coordinates (also on the hole boundary).

For edges and vertices not next to a hole, the standard algorithm from above is used.
