Skip to content

Mixed Polygon Support

Latest
Compare
Choose a tag to compare
@jay-hennen jay-hennen released this 28 Jul 22:46
· 6 commits to master since this release

cell_tree2d now supports being built over mixed polygons.

Vertices are still defined by a Nx2 numpy array. Faces can now be a NxM array of integer indices into the vertices array, or a length K array of indices accompanied by a separate array of N polygon lengths.

(In the following 'vXY' is the index of the vertex Y of the polygon X)
faces = [v00, v01, v02, v03, v04,      v10, v11, v12]
len_arr = [5, 3]

If the Faces array is NxM, it is assumed that there is 1 polygon per row with max number of sides M. 'Masked' indices are indicated with a value of -1. This indicates the polygon has fewer sides than the max. For example, in this 2x5 faces array:

faces = [[v00,v01,v02,v03,v04] (polygon with 5 sides)
         [v10,v11,v12, -1, -1]] (polygon with 3 sides)
len_arr = OPTIONAL

If no polygons contain a -1, then all the polygons have the same number of sides.

In the C:

  • Construction has been split into a more modular system. It now consists of three distinct functions (add_vertices(), add_polys(), and finalize()) that are used in the Cython to set the cell tree up.
  • Field types have been refactored to be more appropriate for their role