@@ -303,6 +303,32 @@ def mesh_subdivide_catmullclark(mesh, k=1, fixed=None):
303303 >>> subd.number_of_faces() == mesh.number_of_faces() * 4 ** k
304304 True
305305
306+ The algorithm supports "integer creasing" as described in
307+ Subdivision Surfaces in Character Animation [1]_.
308+ Creases are supported through the optional edge attribute ``'crease'``,
309+ which can be set to an integer value that defines how sharp the crease is wrt
310+ the number of subdivision steps.
311+
312+ To add an infinitely sharp crease to an edge, set the ``'crease'`` attribute of the edge
313+ to a number higher than the number of subdivision steps.
314+
315+ >>> from compas.geometry import Box, dot_vectors
316+ >>> from compas.datastructures import Mesh
317+
318+ >>> cage = Mesh.from_shape(Box.from_width_height_depth(1, 1, 1))
319+ >>> cage.update_default_edge_attributes({'crease': 0})
320+ >>> top = sorted(cage.faces(), key=lambda face: dot_vectors(cage.face_normal(face), [0, 0, 1]))[-1]
321+ >>> cage.edges_attribute('crease', 5, keys=list(cage.face_halfedges(top)))
322+
323+ >>> subd = cage.subdivide(k=4)
324+
325+ References
326+ ----------
327+ .. [1] Tony DeRose, Michael Kass and Tien Truong.
328+ Subdivision Surfaces in Character Animation.
329+ Pixar Animation Studios.
330+ see https://graphics.pixar.com/library/Geri/paper.pdf
331+
306332 """
307333 cls = type (mesh )
308334 if not fixed :
0 commit comments