neurospatial.layout.engines.triangular_mesh¶
triangular_mesh
¶
Classes¶
TriangularMeshLayout
¶
Bases: _NeighborPairsMixin
A LayoutEngine that builds a triangular mesh over interior points (auto-generated) clipped to a boundary polygon. Each triangle whose centroid lies inside the polygon is kept as an active bin. Connectivity by shared faces.
Source code in src/neurospatial/layout/engines/triangular_mesh.py
Functions¶
build
¶
Build the triangular mesh layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
boundary_polygon
|
Polygon
|
The polygon defining the boundary. Triangles with centroids outside this polygon are discarded. |
required |
point_spacing
|
float
|
Spacing of the square lattice of interior sample points, in the units of the polygon coordinates. Every ring of the polygon is also sampled at most this far apart. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
ValueError
|
If |
Source code in src/neurospatial/layout/engines/triangular_mesh.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
binning
¶
Return owned triangles, lookup and lazy shared-edge faces.
Raises:
| Type | Description |
|---|---|
LayoutNotBuiltError
|
If the layout has not been built. |
Source code in src/neurospatial/layout/engines/triangular_mesh.py
bin_shapes
¶
Return mesh points and the active triangles in bin order.
Source code in src/neurospatial/layout/engines/triangular_mesh.py
outline
¶
Return the mesh boundary, including its interior rings when present.
Source code in src/neurospatial/layout/engines/triangular_mesh.py
bin_sizes
¶
Return the N-dimensional volume of each active N-simplex (bin).
For 2D, this is area. For 3D, this is volume, and so on. The volume of an N-simplex with vertices v0, v1, ..., vn is calculated as: V = (1 / n!) * |det([v1-v0, v2-v0, ..., vn-v0])| where n is the number of dimensions.
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Array of N-dimensional volumes, shape (n_active_simplices,). |
Raises:
| Type | Description |
|---|---|
LayoutNotBuiltError
|
If the layout has not been built. |