face_adjacency_numpy

compas.topology.face_adjacency_numpy(xyz, faces)[source]

Construct an adjacency dictionary of the given faces, assuming that the faces have arbitrary orientation.

Parameters
  • xyz (sequence[[float, float, float] | compas.geometry.Point]) – The coordinates of the face vertices.

  • faces (sequence[sequence[int]]) – A list of faces with each face defined by a list of indices into the list of xyz coordinates.

Returns

dict[int, list[int]] – For every face a list of neighbouring faces.

Notes

If the number of faces is larger than one hundred (100), this function uses Scipy’s cKDTree for limiting the search for neighbours to the immediate surroundings of any given face.

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]]
>>> face_adjacency_numpy(vertices, faces)
{0: [1], 1: [0]}