mesh_subdivide_catmullclark

compas.datastructures.mesh_subdivide_catmullclark(mesh, k=1, fixed=None)[source]

Subdivide a mesh using the Catmull-Clark algorithm.

Parameters
  • mesh (Mesh) – The mesh object that will be subdivided.

  • k (int) – Optional. The number of levels of subdivision. Default is 1.

  • fixed (list) – Optional. A list of fixed vertices. Default is None.

Returns

Mesh – A new subdivided mesh.

Notes

Note that Catmull-Clark subdivision is like Quad subdivision, but with smoothing after every level of further subdivision. Smoothing is done according to the scheme prescribed by the Catmull-Clark algorithm.

Examples

>>> box = Box.from_corner_corner_height([0.0, 0.0, 0.0], [1.0, 1.0, 0.0], 1.0)
>>> mesh = Mesh.from_shape(box)
>>> k = 2
>>> subd = mesh_subdivide_catmullclark(mesh, k=k)
>>> mesh is subd
False
>>> type(mesh) is type(subd)
True
>>> subd.number_of_faces() == mesh.number_of_faces() * 4 ** k
True