unify_cycles_numpy

compas.topology.unify_cycles_numpy(vertices, faces, root=0)[source]

Unify the cycle directions of the given faces such that adjacent faces share opposite halfedges.

Parameters
  • vertices (list) – A list of vertex coordinates.

  • faces (list) – A list of lists of face vertex indices.

  • root (int, optional) – The starting face.

Returns

list – A list of faces with the same orientation as the root face.

Raises

AssertionError – If not all faces were visited.

Examples

>>> vertices = [[0.0, 0.0, 0.0], [1.0, 0.0, 0.0], [1.0, 1.0, 0.0], [0.0, 1.0, 1.0]]
>>> faces = [[0, 1, 2], [0, 3, 2]]
>>> unify_cycles(vertices, faces)
[[0, 1, 2], [2, 3, 0]]