pyviewfactor 0.1.14__tar.gz → 0.1.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/PKG-INFO +1 -1
- pyviewfactor-0.1.16/pyviewfactor/__init__.py +35 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/pyviewfactor/_version.py +1 -1
- pyviewfactor-0.1.16/pyviewfactor/pvf_geometry_preprocess.py +386 -0
- pyviewfactor-0.1.16/pyviewfactor/pvf_integrators.py +315 -0
- pyviewfactor-0.1.16/pyviewfactor/pvf_plot.py +87 -0
- pyviewfactor-0.1.16/pyviewfactor/pvf_viewfactor_computations.py +355 -0
- pyviewfactor-0.1.16/pyviewfactor/pvf_visibility_obstruction.py +496 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/pyviewfactor.egg-info/PKG-INFO +1 -1
- pyviewfactor-0.1.16/pyviewfactor.egg-info/SOURCES.txt +21 -0
- pyviewfactor-0.1.16/test/test_geometry_preprocess.py +104 -0
- pyviewfactor-0.1.14/test/test_utils.py → pyviewfactor-0.1.16/test/test_plot.py +1 -19
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/test/test_visibility_obstruction.py +30 -59
- pyviewfactor-0.1.14/pyviewfactor/11pyviewfactor.py +0 -1166
- pyviewfactor-0.1.14/pyviewfactor/OLD.py +0 -984
- pyviewfactor-0.1.14/pyviewfactor/__init__.py +0 -5
- pyviewfactor-0.1.14/pyviewfactor/pyviewfactor.py +0 -1205
- pyviewfactor-0.1.14/pyviewfactor/pyviewfactor_906.py +0 -1647
- pyviewfactor-0.1.14/pyviewfactor/pyviewfactor_BKP12-06.py +0 -1341
- pyviewfactor-0.1.14/pyviewfactor/pyviewfactor_integration.py +0 -1242
- pyviewfactor-0.1.14/pyviewfactor/pyviewfactor_v1.py +0 -1008
- pyviewfactor-0.1.14/pyviewfactor/pyviewfactor_vis_obs_OK.py +0 -1206
- pyviewfactor-0.1.14/pyviewfactor/pyviewfactorv2.py +0 -1719
- pyviewfactor-0.1.14/pyviewfactor.egg-info/SOURCES.txt +0 -24
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/LICENSE.txt +0 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/README.md +0 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/pyviewfactor.egg-info/dependency_links.txt +0 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/pyviewfactor.egg-info/requires.txt +0 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/pyviewfactor.egg-info/top_level.txt +0 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/setup.cfg +0 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/setup.py +0 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/test/__init__.py +0 -0
- {pyviewfactor-0.1.14 → pyviewfactor-0.1.16}/test/test_view_factor.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pyviewfactor
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.16
|
|
4
4
|
Summary: A python library to calculate numerically exact radiation view factors between planar faces.
|
|
5
5
|
Home-page: https://gitlab.com/arep-dev/pyViewFactor/
|
|
6
6
|
Author: Mateusz BOGDAN, Edouard WALTHER, Marc ALECIAN, Mina CHAPON
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
.. include:: ../README.md
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from ._version import __version__
|
|
6
|
+
from .pvf_geometry_preprocess import (
|
|
7
|
+
ProcessedGeometry,
|
|
8
|
+
FaceMeshPreprocessor,
|
|
9
|
+
fc_unstruc2poly,
|
|
10
|
+
face_to_array,
|
|
11
|
+
polygon_area,
|
|
12
|
+
polygon_centroid,
|
|
13
|
+
face_normal_numpy,
|
|
14
|
+
tri_overlaps_aabb
|
|
15
|
+
)
|
|
16
|
+
from .pvf_visibility_obstruction import (
|
|
17
|
+
get_visibility,
|
|
18
|
+
get_visibility_from_cache,
|
|
19
|
+
get_obstruction,
|
|
20
|
+
get_obstruction_from_cache
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
from .pvf_integrators import (
|
|
24
|
+
set_quadrature_order,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
from .pvf_viewfactor_computations import (
|
|
28
|
+
compute_viewfactor,
|
|
29
|
+
batch_compute_viewfactors,
|
|
30
|
+
compute_viewfactor_matrix
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
from .pvf_plot import (
|
|
34
|
+
plot_viewfactor
|
|
35
|
+
)
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
"""
|
|
2
|
+
`file: pvf_geometry.py`
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import pyvista as pv
|
|
7
|
+
from numba import njit
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def fc_unstruc2poly(mesh_unstruc):
|
|
11
|
+
"""Convenience conversion function from UnstructuredGrid to PolyData
|
|
12
|
+
|
|
13
|
+
Parameters
|
|
14
|
+
----------
|
|
15
|
+
* **mesh_unstruc** : *pyvista.UnstructuredGrid*
|
|
16
|
+
|
|
17
|
+
> Unstructured Pyvista Grid.
|
|
18
|
+
|
|
19
|
+
Returns
|
|
20
|
+
-------
|
|
21
|
+
* *pyvista.PolyData*
|
|
22
|
+
|
|
23
|
+
> The same mesh converted to a surface pyvista.PolyData.
|
|
24
|
+
|
|
25
|
+
Examples
|
|
26
|
+
--------
|
|
27
|
+
>>> import pyviewfactor as pvf
|
|
28
|
+
>>> import pyvista as pv
|
|
29
|
+
>>> sphere = pv.Sphere(radius=0.5, center=(0, 0, 0))
|
|
30
|
+
>>> subset = sphere.extract_cells(10)
|
|
31
|
+
>>> subsetPoly = fc_unstruc2poly(subset)
|
|
32
|
+
>>> subsetPoly
|
|
33
|
+
PolyData (0x1fdd9786040)
|
|
34
|
+
N Cells: 1
|
|
35
|
+
N Points: 3
|
|
36
|
+
X Bounds: -5.551e-17, 3.617e-02
|
|
37
|
+
Y Bounds: 0.000e+00, 4.682e-02
|
|
38
|
+
Z Bounds: -5.000e-01, -4.971e-01
|
|
39
|
+
N Arrays: 0
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
# Get the points and cells
|
|
44
|
+
points = mesh_unstruc.points
|
|
45
|
+
faces = mesh_unstruc.cells
|
|
46
|
+
# Return the same geometry as a pv.PolyData mesh
|
|
47
|
+
return pv.PolyData(points, faces)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def face_to_array(face):
|
|
51
|
+
"""
|
|
52
|
+
Extract the vertex coordinates of a single PolyData face as a NumPy array.
|
|
53
|
+
|
|
54
|
+
Parameters
|
|
55
|
+
----------
|
|
56
|
+
* **face** : *pyvista.PolyData*
|
|
57
|
+
|
|
58
|
+
> PolyData containing exactly one face.
|
|
59
|
+
|
|
60
|
+
Returns
|
|
61
|
+
-------
|
|
62
|
+
* *numpy.ndarray* (n, 3)
|
|
63
|
+
|
|
64
|
+
> The (x, y, z) coordinates of the face's vertices.
|
|
65
|
+
"""
|
|
66
|
+
return face.get_cell(0).points.astype(np.float64)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@njit
|
|
70
|
+
def face_normal_numpy(pts):
|
|
71
|
+
"""
|
|
72
|
+
Compute the right-handed unit normal vector of a planar polygon.
|
|
73
|
+
|
|
74
|
+
Parameters
|
|
75
|
+
----------
|
|
76
|
+
* **pts** : *numpy.ndarray*, shape (n, 3)
|
|
77
|
+
|
|
78
|
+
> Coordinates of the polygon's vertices in order.
|
|
79
|
+
Handles n>3
|
|
80
|
+
|
|
81
|
+
Returns
|
|
82
|
+
-------
|
|
83
|
+
* *numpy.ndarray* (3,)
|
|
84
|
+
|
|
85
|
+
> Unit normal vector (x, y, z). If degenerate, returns [0, 0, 1].
|
|
86
|
+
"""
|
|
87
|
+
n = pts.shape[0]
|
|
88
|
+
# Newell's method (robust for convex planar polygons)
|
|
89
|
+
nx = 0.0
|
|
90
|
+
ny = 0.0
|
|
91
|
+
nz = 0.0
|
|
92
|
+
for i in range(n):
|
|
93
|
+
j = (i + 1) % n
|
|
94
|
+
nx += (pts[i, 1] - pts[j, 1]) * (pts[i, 2] + pts[j, 2])
|
|
95
|
+
ny += (pts[i, 2] - pts[j, 2]) * (pts[i, 0] + pts[j, 0])
|
|
96
|
+
nz += (pts[i, 0] - pts[j, 0]) * (pts[i, 1] + pts[j, 1])
|
|
97
|
+
norm = np.sqrt(nx*nx + ny*ny + nz*nz)
|
|
98
|
+
if norm < 1e-12:
|
|
99
|
+
return np.array([0.0, 0.0, 1.0])
|
|
100
|
+
return np.array([nx, ny, nz]) / norm
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def polygon_area(pts):
|
|
104
|
+
"""
|
|
105
|
+
Compute the area of a planar polygon given its ordered vertices.
|
|
106
|
+
|
|
107
|
+
Parameters
|
|
108
|
+
----------
|
|
109
|
+
* **pts** : *numpy.ndarray*, shape (n, 3)
|
|
110
|
+
|
|
111
|
+
> Coordinates of the polygon's vertices.
|
|
112
|
+
|
|
113
|
+
Returns
|
|
114
|
+
-------
|
|
115
|
+
* *float*
|
|
116
|
+
|
|
117
|
+
> Area of the polygon.
|
|
118
|
+
"""
|
|
119
|
+
# Compute normal
|
|
120
|
+
n = face_normal_numpy(pts)
|
|
121
|
+
# Use polygon centroid and cross product trick
|
|
122
|
+
area = 0.0
|
|
123
|
+
n_pts = pts.shape[0]
|
|
124
|
+
for i in range(n_pts):
|
|
125
|
+
v0 = pts[i]
|
|
126
|
+
v1 = pts[(i + 1) % n_pts]
|
|
127
|
+
area += np.dot(n, np.cross(v0, v1))
|
|
128
|
+
return 0.5 * np.abs(area)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def polygon_centroid(pts: np.ndarray) -> np.ndarray:
|
|
132
|
+
"""
|
|
133
|
+
Compute the area-weighted centroid of a planar polygon in 3D.
|
|
134
|
+
|
|
135
|
+
Parameters
|
|
136
|
+
----------
|
|
137
|
+
* **pts** : *numpy.ndarray*, shape (n, 3)
|
|
138
|
+
> Ordered vertex coordinates.
|
|
139
|
+
|
|
140
|
+
Returns
|
|
141
|
+
-------
|
|
142
|
+
* *numpy.ndarray*, shape (3,)
|
|
143
|
+
> The (x, y, z) centroid coordinates.
|
|
144
|
+
"""
|
|
145
|
+
p0, p1, p2 = pts[0], pts[1], pts[2]
|
|
146
|
+
v1 = p1 - p0
|
|
147
|
+
v2 = p2 - p0
|
|
148
|
+
normal = np.cross(v1, v2)
|
|
149
|
+
normal /= np.linalg.norm(normal)
|
|
150
|
+
u = v1 / np.linalg.norm(v1)
|
|
151
|
+
w = np.cross(normal, u)
|
|
152
|
+
proj = np.array([[np.dot(p - p0, u), np.dot(p - p0, w)] for p in pts])
|
|
153
|
+
A = 0.0
|
|
154
|
+
Cx = 0.0
|
|
155
|
+
Cy = 0.0
|
|
156
|
+
N = proj.shape[0]
|
|
157
|
+
for i in range(N):
|
|
158
|
+
x0, y0 = proj[i]
|
|
159
|
+
x1, y1 = proj[(i + 1) % N]
|
|
160
|
+
cross = x0 * y1 - x1 * y0
|
|
161
|
+
A += cross
|
|
162
|
+
Cx += (x0 + x1) * cross
|
|
163
|
+
Cy += (y0 + y1) * cross
|
|
164
|
+
A *= 0.5
|
|
165
|
+
if np.abs(A) < 1e-12:
|
|
166
|
+
return np.mean(pts, axis=0)
|
|
167
|
+
centroid_2D = np.array([Cx / (6 * A), Cy / (6 * A)])
|
|
168
|
+
return p0 + centroid_2D[0] * u + centroid_2D[1] * w
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
@njit
|
|
172
|
+
def tri_overlaps_aabb(tri_pts, aabb_min, aabb_max):
|
|
173
|
+
"""
|
|
174
|
+
JIT-compatible test if a triangle (by vertex coordinates)
|
|
175
|
+
overlaps an axis-aligned bounding box.
|
|
176
|
+
|
|
177
|
+
Parameters
|
|
178
|
+
----------
|
|
179
|
+
* **tri_pts** : *numpy.ndarray*, shape (3, 3)
|
|
180
|
+
> Vertices of the triangle.
|
|
181
|
+
|
|
182
|
+
* **aabb_min** : *numpy.ndarray*, shape (3,)
|
|
183
|
+
> Minimum x, y, z of the bounding box.
|
|
184
|
+
|
|
185
|
+
* **aabb_max** : *numpy.ndarray*, shape (3,)
|
|
186
|
+
> Maximum x, y, z of the bounding box.
|
|
187
|
+
|
|
188
|
+
Returns
|
|
189
|
+
-------
|
|
190
|
+
* *bool*
|
|
191
|
+
> True if the triangle overlaps the box, False otherwise.
|
|
192
|
+
"""
|
|
193
|
+
# initialize with the first vertex
|
|
194
|
+
tri_min0 = tri_pts[0, 0]
|
|
195
|
+
tri_min1 = tri_pts[0, 1]
|
|
196
|
+
tri_min2 = tri_pts[0, 2]
|
|
197
|
+
tri_max0 = tri_min0
|
|
198
|
+
tri_max1 = tri_min1
|
|
199
|
+
tri_max2 = tri_min2
|
|
200
|
+
|
|
201
|
+
# find true min/max over the three vertices
|
|
202
|
+
for i in range(1, tri_pts.shape[0]):
|
|
203
|
+
x, y, z = tri_pts[i, 0], tri_pts[i, 1], tri_pts[i, 2]
|
|
204
|
+
if x < tri_min0:
|
|
205
|
+
tri_min0 = x
|
|
206
|
+
if y < tri_min1:
|
|
207
|
+
tri_min1 = y
|
|
208
|
+
if z < tri_min2:
|
|
209
|
+
tri_min2 = z
|
|
210
|
+
if x > tri_max0:
|
|
211
|
+
tri_max0 = x
|
|
212
|
+
if y > tri_max1:
|
|
213
|
+
tri_max1 = y
|
|
214
|
+
if z > tri_max2:
|
|
215
|
+
tri_max2 = z
|
|
216
|
+
|
|
217
|
+
# now test overlap
|
|
218
|
+
return (
|
|
219
|
+
(tri_max0 >= aabb_min[0]) and (tri_min0 <= aabb_max[0]) and
|
|
220
|
+
(tri_max1 >= aabb_min[1]) and (tri_min1 <= aabb_max[1]) and
|
|
221
|
+
(tri_max2 >= aabb_min[2]) and (tri_min2 <= aabb_max[2])
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class ProcessedGeometry:
|
|
226
|
+
"""
|
|
227
|
+
Cache geometry of all faces in a mesh for high-performance view factor computation.
|
|
228
|
+
|
|
229
|
+
Attributes
|
|
230
|
+
----------
|
|
231
|
+
* **rounding_decimal** : *int*
|
|
232
|
+
|
|
233
|
+
> Number of decimals to round coordinates for robustness.
|
|
234
|
+
|
|
235
|
+
* **N** : *int*
|
|
236
|
+
|
|
237
|
+
> Number of faces in the mesh.
|
|
238
|
+
|
|
239
|
+
* **points** : list of ndarray
|
|
240
|
+
|
|
241
|
+
> List of (n, 3) arrays with the coordinates of each face's vertices.
|
|
242
|
+
|
|
243
|
+
* **normals** : *ndarray*, shape (N, 3)
|
|
244
|
+
|
|
245
|
+
> Unit normal vectors for each face.
|
|
246
|
+
|
|
247
|
+
* **centroids** : *ndarray*, shape (N, 3)
|
|
248
|
+
|
|
249
|
+
> Area-weighted centroid for each face.
|
|
250
|
+
|
|
251
|
+
* **areas** : *ndarray*, shape (N,)
|
|
252
|
+
|
|
253
|
+
> Area of each face.
|
|
254
|
+
|
|
255
|
+
**sizes** : *ndarray*, shape (N,)
|
|
256
|
+
|
|
257
|
+
> Mean edge length for each face.
|
|
258
|
+
|
|
259
|
+
Methods
|
|
260
|
+
-------
|
|
261
|
+
* `get_face(i)`
|
|
262
|
+
|
|
263
|
+
> Return the (n, 3) vertex array for face i.
|
|
264
|
+
|
|
265
|
+
`get_normal(i)`
|
|
266
|
+
|
|
267
|
+
> Return the normal vector for face i.
|
|
268
|
+
|
|
269
|
+
* `get_centroid(i)`
|
|
270
|
+
|
|
271
|
+
> Return the centroid for face i.
|
|
272
|
+
|
|
273
|
+
`get_area(i)`
|
|
274
|
+
|
|
275
|
+
> Return the area for face i.
|
|
276
|
+
|
|
277
|
+
* `get_size(i)`
|
|
278
|
+
|
|
279
|
+
> Return the average edge length for face i.
|
|
280
|
+
"""
|
|
281
|
+
def __init__(self, mesh, rounding_decimal=8):
|
|
282
|
+
self.rounding_decimal = rounding_decimal
|
|
283
|
+
self.N = mesh.n_cells
|
|
284
|
+
self.points = []
|
|
285
|
+
self.normals = np.zeros((self.N, 3), dtype=np.float64)
|
|
286
|
+
self.centroids = np.zeros((self.N, 3), dtype=np.float64)
|
|
287
|
+
self.areas = np.zeros(self.N, dtype=np.float64)
|
|
288
|
+
self.sizes = np.zeros(self.N, dtype=np.float64)
|
|
289
|
+
|
|
290
|
+
for i in range(self.N):
|
|
291
|
+
raw = mesh.extract_cells(i)
|
|
292
|
+
face = fc_unstruc2poly(raw)
|
|
293
|
+
faces_i = face.faces
|
|
294
|
+
n_i = int(faces_i[0])
|
|
295
|
+
idxs = faces_i[1:1 + n_i]
|
|
296
|
+
pts = np.round(face.points[idxs], rounding_decimal)
|
|
297
|
+
|
|
298
|
+
self.points.append(pts)
|
|
299
|
+
self.centroids[i] = polygon_centroid(pts)
|
|
300
|
+
|
|
301
|
+
v1 = pts[1] - pts[0]
|
|
302
|
+
v2 = pts[2] - pts[0]
|
|
303
|
+
norm = np.cross(v1, v2)
|
|
304
|
+
self.normals[i] = norm / np.linalg.norm(norm)
|
|
305
|
+
|
|
306
|
+
self.areas[i] = polygon_area(np.round(face.points, rounding_decimal))
|
|
307
|
+
edges = np.roll(pts, -1, axis=0) - pts
|
|
308
|
+
edge_lengths = np.linalg.norm(edges, axis=1)
|
|
309
|
+
self.sizes[i] = np.mean(edge_lengths)
|
|
310
|
+
|
|
311
|
+
def get_face(self, i):
|
|
312
|
+
return self.points[i]
|
|
313
|
+
|
|
314
|
+
def get_normal(self, i):
|
|
315
|
+
return self.normals[i]
|
|
316
|
+
|
|
317
|
+
def get_centroid(self, i):
|
|
318
|
+
return self.centroids[i]
|
|
319
|
+
|
|
320
|
+
def get_area(self, i):
|
|
321
|
+
return self.areas[i]
|
|
322
|
+
|
|
323
|
+
def get_size(self, i):
|
|
324
|
+
return self.sizes[i]
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class FaceMeshPreprocessor:
|
|
328
|
+
"""
|
|
329
|
+
Efficiently preprocess a PolyData mesh for obstruction and overlap queries.
|
|
330
|
+
|
|
331
|
+
Converts mesh to all triangles and provides fast spatial filtering.
|
|
332
|
+
|
|
333
|
+
Attributes
|
|
334
|
+
----------
|
|
335
|
+
* **points** : *ndarray* (N_pts, 3)
|
|
336
|
+
|
|
337
|
+
> All vertex coordinates.
|
|
338
|
+
|
|
339
|
+
* **faces** : *ndarray* (N_cells, 3)
|
|
340
|
+
|
|
341
|
+
> Triangle vertex indices.
|
|
342
|
+
|
|
343
|
+
* **triangles** : *ndarray* (N_cells, 3, 3)
|
|
344
|
+
|
|
345
|
+
> Vertices of all triangles.
|
|
346
|
+
|
|
347
|
+
Methods
|
|
348
|
+
-------
|
|
349
|
+
* `aabb_filter(aabb_min, aabb_max)`
|
|
350
|
+
|
|
351
|
+
> Return only those triangles overlapping a given axis-aligned bounding box.
|
|
352
|
+
|
|
353
|
+
* `exclude_exact_match(pts1, pts2, tris)`
|
|
354
|
+
|
|
355
|
+
> Remove triangles that exactly match either pts1 or pts2.
|
|
356
|
+
"""
|
|
357
|
+
def __init__(self, mesh: pv.PolyData):
|
|
358
|
+
if not mesh.is_all_triangles:
|
|
359
|
+
mesh = mesh.triangulate()
|
|
360
|
+
self.points = mesh.points.astype(np.float64)
|
|
361
|
+
# cells array is [n, i0, i1, i2, n, ...]
|
|
362
|
+
cells = mesh.faces.reshape(-1, 4)[:, 1:]
|
|
363
|
+
self.faces = cells # shape (n_cells,3)
|
|
364
|
+
self.triangles = np.array([self.points[c] for c in cells], dtype=np.float64)
|
|
365
|
+
|
|
366
|
+
def aabb_filter(self, aabb_min, aabb_max):
|
|
367
|
+
kept = []
|
|
368
|
+
for tri in self.triangles: # tri.shape == (3,3)
|
|
369
|
+
if tri_overlaps_aabb(tri, aabb_min, aabb_max):
|
|
370
|
+
kept.append(tri)
|
|
371
|
+
return np.array(kept, dtype=np.float64)
|
|
372
|
+
|
|
373
|
+
def exclude_exact_match(self, pts1, pts2, tris):
|
|
374
|
+
# build frozensets of each vertex array
|
|
375
|
+
vs1 = frozenset(sorted(tuple(np.round(p, 8)) for p in pts1))
|
|
376
|
+
vs2 = frozenset(sorted(tuple(np.round(p, 8)) for p in pts2))
|
|
377
|
+
out = []
|
|
378
|
+
for tri in tris:
|
|
379
|
+
tri_set = frozenset(sorted(tuple(np.round(p, 8)) for p in tri))
|
|
380
|
+
if not tri_set.isdisjoint(vs1) or not tri_set.isdisjoint(vs2):
|
|
381
|
+
continue
|
|
382
|
+
out.append(tri)
|
|
383
|
+
return np.array(out, dtype=np.float64)
|
|
384
|
+
|
|
385
|
+
# #-----------------------------------------------------------------------------------#
|
|
386
|
+
# End of File
|