trenchfoot 0.3.1__py3-none-any.whl → 0.4.0__py3-none-any.whl
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.
Potentially problematic release.
This version of trenchfoot might be problematic. Click here for more details.
- trenchfoot/generate_scenarios.py +27 -27
- trenchfoot/render_colors.py +1 -0
- trenchfoot/trench_scene_generator_v3.py +58 -10
- {trenchfoot-0.3.1.dist-info → trenchfoot-0.4.0.dist-info}/METADATA +1 -1
- {trenchfoot-0.3.1.dist-info → trenchfoot-0.4.0.dist-info}/RECORD +8 -8
- {trenchfoot-0.3.1.dist-info → trenchfoot-0.4.0.dist-info}/WHEEL +0 -0
- {trenchfoot-0.3.1.dist-info → trenchfoot-0.4.0.dist-info}/entry_points.txt +0 -0
- {trenchfoot-0.3.1.dist-info → trenchfoot-0.4.0.dist-info}/licenses/LICENSE +0 -0
trenchfoot/generate_scenarios.py
CHANGED
|
@@ -223,9 +223,9 @@ def default_scenarios() -> List[ScenarioDefinition]:
|
|
|
223
223
|
],
|
|
224
224
|
"boxes": [
|
|
225
225
|
{
|
|
226
|
-
"along": 0.
|
|
227
|
-
"across": 0.
|
|
228
|
-
"height": 0.
|
|
226
|
+
"along": 0.4,
|
|
227
|
+
"across": 0.3,
|
|
228
|
+
"height": 0.25,
|
|
229
229
|
"s": 0.55,
|
|
230
230
|
"offset_u": 0.0,
|
|
231
231
|
}
|
|
@@ -266,7 +266,7 @@ def default_scenarios() -> List[ScenarioDefinition]:
|
|
|
266
266
|
"angle_deg": 45,
|
|
267
267
|
"s_center": 0.55,
|
|
268
268
|
"z": -0.65,
|
|
269
|
-
"offset_u": -0.
|
|
269
|
+
"offset_u": -0.4,
|
|
270
270
|
},
|
|
271
271
|
{
|
|
272
272
|
"radius": 0.08,
|
|
@@ -304,7 +304,7 @@ def default_scenarios() -> List[ScenarioDefinition]:
|
|
|
304
304
|
"radius": 0.2,
|
|
305
305
|
"length": 5.5,
|
|
306
306
|
"angle_deg": 10,
|
|
307
|
-
"s_center": 0.
|
|
307
|
+
"s_center": 0.2,
|
|
308
308
|
"z": -0.4,
|
|
309
309
|
"offset_u": 0.3,
|
|
310
310
|
"clearance_scale": 0.9,
|
|
@@ -324,8 +324,8 @@ def default_scenarios() -> List[ScenarioDefinition]:
|
|
|
324
324
|
"along": 1.2,
|
|
325
325
|
"across": 0.9,
|
|
326
326
|
"height": 0.35,
|
|
327
|
-
"s": 0.
|
|
328
|
-
"offset_u": -0.
|
|
327
|
+
"s": 0.45,
|
|
328
|
+
"offset_u": -0.4,
|
|
329
329
|
"z": -0.35,
|
|
330
330
|
}
|
|
331
331
|
],
|
|
@@ -344,12 +344,12 @@ def default_scenarios() -> List[ScenarioDefinition]:
|
|
|
344
344
|
ScenarioDefinition(
|
|
345
345
|
"S06_bumpy_wide_loop",
|
|
346
346
|
{
|
|
347
|
-
"path_xy": [[0, 0], [4, -1], [8, 0], [8, 5], [2, 5], [-1, 2]],
|
|
347
|
+
"path_xy": [[0, 0], [4, -1], [8, 0], [8, 5], [2, 5], [-1, 2], [0, 0]],
|
|
348
348
|
"width": 2.6,
|
|
349
349
|
"depth": 0.85,
|
|
350
350
|
"wall_slope": 0.12,
|
|
351
351
|
"ground_margin": 2.0,
|
|
352
|
-
"ground": {"z0": 0.2, "slope": [0.015, 0.03], "size_margin": 1.8},
|
|
352
|
+
"ground": {"z0": 0.2, "slope": [0.015, 0.03], "size_margin": 1.8, "fill_interior": True},
|
|
353
353
|
"pipes": [
|
|
354
354
|
{
|
|
355
355
|
"radius": 0.18,
|
|
@@ -395,41 +395,41 @@ def default_scenarios() -> List[ScenarioDefinition]:
|
|
|
395
395
|
"ground_margin": 1.0,
|
|
396
396
|
"ground": {"z0": 0.0, "slope": [0.0, 0.0], "size_margin": 2.0},
|
|
397
397
|
"pipes": [
|
|
398
|
-
# Upper pipe -
|
|
398
|
+
# Upper pipe - tangential
|
|
399
399
|
{
|
|
400
400
|
"radius": 0.20,
|
|
401
|
-
"length":
|
|
401
|
+
"length": 8.0,
|
|
402
402
|
"angle_deg": 0,
|
|
403
|
-
"s_center": 0.
|
|
403
|
+
"s_center": 0.0,
|
|
404
404
|
"z": -0.5,
|
|
405
|
-
"offset_u": 0.
|
|
405
|
+
"offset_u": -0.4,
|
|
406
406
|
},
|
|
407
|
-
# Middle pipe -
|
|
407
|
+
# Middle pipe - tangential
|
|
408
408
|
{
|
|
409
409
|
"radius": 0.15,
|
|
410
|
-
"length":
|
|
411
|
-
"angle_deg":
|
|
410
|
+
"length": 7.5,
|
|
411
|
+
"angle_deg": 0,
|
|
412
412
|
"s_center": 0.5,
|
|
413
413
|
"z": -1.2,
|
|
414
|
-
"offset_u": 0.
|
|
414
|
+
"offset_u": -0.4,
|
|
415
415
|
},
|
|
416
|
-
# Lower pipe -
|
|
416
|
+
# Lower pipe - tangential
|
|
417
417
|
{
|
|
418
418
|
"radius": 0.10,
|
|
419
|
-
"length":
|
|
420
|
-
"angle_deg":
|
|
421
|
-
"s_center": 0.
|
|
419
|
+
"length": 7.0,
|
|
420
|
+
"angle_deg": 0,
|
|
421
|
+
"s_center": 0.25,
|
|
422
422
|
"z": -1.8,
|
|
423
|
-
"offset_u": -0.
|
|
423
|
+
"offset_u": -0.4,
|
|
424
424
|
},
|
|
425
|
-
# Deep pipe -
|
|
425
|
+
# Deep pipe - tangential
|
|
426
426
|
{
|
|
427
427
|
"radius": 0.12,
|
|
428
|
-
"length":
|
|
429
|
-
"angle_deg":
|
|
430
|
-
"s_center": 0.
|
|
428
|
+
"length": 7.5,
|
|
429
|
+
"angle_deg": 0,
|
|
430
|
+
"s_center": 0.75,
|
|
431
431
|
"z": -2.2,
|
|
432
|
-
"offset_u": 0.
|
|
432
|
+
"offset_u": -0.4,
|
|
433
433
|
},
|
|
434
434
|
],
|
|
435
435
|
"boxes": [],
|
trenchfoot/render_colors.py
CHANGED
|
@@ -34,7 +34,7 @@ except Exception:
|
|
|
34
34
|
Poly3DCollection = None
|
|
35
35
|
|
|
36
36
|
# Groups kept for internal metrics but excluded from OBJ export and previews
|
|
37
|
-
_INTERNAL_GROUPS = frozenset({"trench_cap_for_volume"})
|
|
37
|
+
_INTERNAL_GROUPS = frozenset({"trench_cap_for_volume", "inner_column_lid"})
|
|
38
38
|
|
|
39
39
|
# ---------------- Geometry helpers ----------------
|
|
40
40
|
|
|
@@ -123,6 +123,9 @@ def _offset_closed_polyline(path: List[Tuple[float,float]], offset: float) -> Li
|
|
|
123
123
|
this returns a single continuous closed ring for paths where first ≈ last point.
|
|
124
124
|
"""
|
|
125
125
|
P = np.array(path, float)
|
|
126
|
+
# Remove duplicate closing point if present (first ≈ last)
|
|
127
|
+
if len(P) > 1 and np.linalg.norm(P[0] - P[-1]) < 0.01:
|
|
128
|
+
P = P[:-1]
|
|
126
129
|
n = len(P)
|
|
127
130
|
if n < 3:
|
|
128
131
|
raise ValueError("Closed polyline needs at least 3 points")
|
|
@@ -405,6 +408,7 @@ class GroundSpec:
|
|
|
405
408
|
z0: float = 0.0
|
|
406
409
|
slope: Tuple[float,float] = (0.0, 0.0) # (dz/dx, dz/dy)
|
|
407
410
|
size_margin: float = 3.0
|
|
411
|
+
fill_interior: bool = False # For closed paths: fill the interior with ground surface
|
|
408
412
|
|
|
409
413
|
@dataclass
|
|
410
414
|
class SceneSpec:
|
|
@@ -735,6 +739,16 @@ def make_trench_from_path_sloped(path_xy: List[Tuple[float,float]], width_top: f
|
|
|
735
739
|
V_walls = np.array(walls_V, float)
|
|
736
740
|
F_walls = np.array(walls_F, int)
|
|
737
741
|
|
|
742
|
+
# Inner column lid: cap the top of the inner column at ground level
|
|
743
|
+
# Reverse inner_top to get CCW winding for upward-facing normals
|
|
744
|
+
inner_top_ccw = inner_top[::-1].copy()
|
|
745
|
+
z_inner_top_ccw = z_inner_top[::-1].copy()
|
|
746
|
+
lid_xy, lid_faces = _triangulate_polygon_fan(inner_top_ccw)
|
|
747
|
+
# Assign z-values: polygon vertices use z_inner_top_ccw, centroid uses average
|
|
748
|
+
z_lid = np.concatenate([z_inner_top_ccw, [np.mean(z_inner_top_ccw)]])
|
|
749
|
+
V_lid = np.column_stack([lid_xy, z_lid])
|
|
750
|
+
F_lid = _ensure_upward_normals(V_lid, lid_faces)
|
|
751
|
+
|
|
738
752
|
# For closed path, poly_top is the outer ring (used for ground plane hole)
|
|
739
753
|
poly_top = outer_top
|
|
740
754
|
poly_bot = outer_bot
|
|
@@ -796,6 +810,10 @@ def make_trench_from_path_sloped(path_xy: List[Tuple[float,float]], width_top: f
|
|
|
796
810
|
"trench_walls": (V_walls, F_walls)
|
|
797
811
|
}
|
|
798
812
|
|
|
813
|
+
# Add inner column lid for closed paths
|
|
814
|
+
if is_closed:
|
|
815
|
+
groups["inner_column_lid"] = (V_lid, F_lid)
|
|
816
|
+
|
|
799
817
|
return groups, poly_top, poly_bot, extra
|
|
800
818
|
|
|
801
819
|
def _ensure_upward_normals(V: np.ndarray, F: np.ndarray) -> np.ndarray:
|
|
@@ -830,6 +848,28 @@ def _ensure_upward_normals(V: np.ndarray, F: np.ndarray) -> np.ndarray:
|
|
|
830
848
|
return F_out
|
|
831
849
|
|
|
832
850
|
|
|
851
|
+
def _triangulate_polygon_fan(polygon: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
|
|
852
|
+
"""Triangulate a simple polygon using fan triangulation from centroid.
|
|
853
|
+
|
|
854
|
+
Works well for convex or nearly-convex polygons. Returns (vertices, faces)
|
|
855
|
+
where vertices includes the original polygon points plus the centroid.
|
|
856
|
+
"""
|
|
857
|
+
n = len(polygon)
|
|
858
|
+
centroid = polygon.mean(axis=0)
|
|
859
|
+
|
|
860
|
+
# Vertices: polygon points first, then centroid at the end
|
|
861
|
+
verts = np.vstack([polygon, centroid.reshape(1, -1)])
|
|
862
|
+
centroid_idx = n
|
|
863
|
+
|
|
864
|
+
# Fan triangles from centroid to each edge
|
|
865
|
+
tris = []
|
|
866
|
+
for i in range(n):
|
|
867
|
+
j = (i + 1) % n
|
|
868
|
+
tris.append([centroid_idx, i, j])
|
|
869
|
+
|
|
870
|
+
return verts, np.array(tris, dtype=int)
|
|
871
|
+
|
|
872
|
+
|
|
833
873
|
def _triangulate_annulus(outer: np.ndarray, inner: np.ndarray) -> Tuple[np.ndarray, np.ndarray]:
|
|
834
874
|
"""Triangulate the annular region between outer and inner polygons.
|
|
835
875
|
|
|
@@ -919,9 +959,8 @@ def make_ground_surface_plane(path_xy: List[Tuple[float,float]], width_top: floa
|
|
|
919
959
|
is_closed = _is_path_closed(path_xy)
|
|
920
960
|
|
|
921
961
|
if is_closed:
|
|
922
|
-
# For closed paths
|
|
923
|
-
#
|
|
924
|
-
# The center (inside the trench) is left completely open.
|
|
962
|
+
# For closed paths, ground is an annulus from outer boundary to trench edge.
|
|
963
|
+
# Optionally, if fill_interior is set, also fill the interior island.
|
|
925
964
|
|
|
926
965
|
# Trench outer boundary (edge of trench opening)
|
|
927
966
|
trench_outer = np.array(_offset_closed_polyline(path_xy, half_top), float)
|
|
@@ -933,14 +972,23 @@ def make_ground_surface_plane(path_xy: List[Tuple[float,float]], width_top: floa
|
|
|
933
972
|
trench_outer = _ensure_ccw(trench_outer)
|
|
934
973
|
ground_outer = _ensure_ccw(ground_outer)
|
|
935
974
|
|
|
936
|
-
#
|
|
937
|
-
|
|
938
|
-
|
|
975
|
+
# Outer ground annulus: from ground_outer to trench_outer
|
|
976
|
+
outer_xy, outer_tris = _triangulate_annulus(ground_outer, trench_outer)
|
|
977
|
+
Vg_outer = np.array([[x, y, gfun(x, y)] for (x, y) in outer_xy], float)
|
|
978
|
+
outer_tris = _ensure_upward_normals(Vg_outer, outer_tris)
|
|
939
979
|
|
|
940
|
-
|
|
941
|
-
tris = _ensure_upward_normals(Vg, tris)
|
|
980
|
+
result = {"ground_surface": (Vg_outer, outer_tris)}
|
|
942
981
|
|
|
943
|
-
|
|
982
|
+
# Optionally fill the interior island (for loop trenches, not wells/pits)
|
|
983
|
+
if getattr(ground, 'fill_interior', False):
|
|
984
|
+
trench_inner = np.array(_offset_closed_polyline(path_xy, -half_top), float)
|
|
985
|
+
trench_inner = _ensure_ccw(trench_inner)
|
|
986
|
+
inner_xy, inner_tris = _triangulate_polygon_fan(trench_inner)
|
|
987
|
+
Vg_inner = np.array([[x, y, gfun(x, y)] for (x, y) in inner_xy], float)
|
|
988
|
+
inner_tris = _ensure_upward_normals(Vg_inner, inner_tris)
|
|
989
|
+
result["ground_island"] = (Vg_inner, inner_tris)
|
|
990
|
+
|
|
991
|
+
return result
|
|
944
992
|
else:
|
|
945
993
|
# Open paths: ground forms annulus with extensions past trench endpoints.
|
|
946
994
|
# The outer ring (ground boundary) is extended, but the inner ring (trench
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
trenchfoot/Dockerfile,sha256=TjwHTNOZF6eHxpDjw29uruEmvJ4FWQEv1XRDE3qMJvY,210
|
|
2
2
|
trenchfoot/README.md,sha256=PGpBwprT0ZgR-ASx7bDLm9SvYR8yCbIzML7amq3oJ-k,5483
|
|
3
3
|
trenchfoot/__init__.py,sha256=jI30sofuw13hesvaShlAaatpswxY8wRFVsTJq06TKo8,1672
|
|
4
|
-
trenchfoot/generate_scenarios.py,sha256=
|
|
4
|
+
trenchfoot/generate_scenarios.py,sha256=xZcPdRlDc23Ao6tTWca2g3Ks91s2zALRKGbAIFzxjlc,25495
|
|
5
5
|
trenchfoot/gmsh_sloped_trench_mesher.py,sha256=D7EL6V0wkE6tvDARmm006yZE6KEzCl25OlZQviArBRo,25675
|
|
6
6
|
trenchfoot/plot_mesh.py,sha256=26dOlVfaM1WsUfr_sXVqA7axtY9qjY3WCNM7cUBTS7Q,3810
|
|
7
|
-
trenchfoot/render_colors.py,sha256=
|
|
7
|
+
trenchfoot/render_colors.py,sha256=CWMre6DYa2EyrCgZsEY0bv313WqEhQdr3CdPF1xI-40,1649
|
|
8
8
|
trenchfoot/scene_spec_example.json,sha256=UcV25ku422UO0ZZPDrJwrT1zwmjoOIpnBdLuEdh-AZA,1028
|
|
9
|
-
trenchfoot/trench_scene_generator_v3.py,sha256=
|
|
9
|
+
trenchfoot/trench_scene_generator_v3.py,sha256=sZev3DvkB5HbH3fWcNWGYAWx9XBqkuZfeCzRhIMG8NU,51465
|
|
10
10
|
trenchfoot/scenarios/SUMMARY.json,sha256=uylEzgzIqk5pGBfWVchVFnwwIDGBjNTDY_E23L_iakI,9372
|
|
11
11
|
trenchfoot/scenarios/S01_straight_vwalls/ground_truth_isosurface.html,sha256=SLPROqEefBB8OgmZSW6DBmJxuSDxVQhWTn9eG3q6QRU,5880178
|
|
12
12
|
trenchfoot/scenarios/S01_straight_vwalls/metrics.json,sha256=7VDscjZdxNPgNZaPHzRHYBJ1a5amNgJ7XYKCezVJJKQ,691
|
|
@@ -85,8 +85,8 @@ trenchfoot/scenarios/S07_circular_well/scene.json,sha256=bvror2YX6aNbsEc25-N7JO3
|
|
|
85
85
|
trenchfoot/scenarios/S07_circular_well/sdf_metadata.json,sha256=2jYlePeCTX1OyROWCaRQ_IjDlyjc5_YGYSUZg6eN3lc,5602
|
|
86
86
|
trenchfoot/scenarios/S07_circular_well/trench_scene.obj,sha256=leTTT0i5xE-fvFSzHLNf_JBsU0AN3YqadDx4HmNmFhU,1618101
|
|
87
87
|
trenchfoot/scenarios/S07_circular_well/volumetric/trench_volume.msh,sha256=dqhtd3SFKj5RLT_BcWIIvVGCbAqvOx7RX25-K7NKX10,615212
|
|
88
|
-
trenchfoot-0.
|
|
89
|
-
trenchfoot-0.
|
|
90
|
-
trenchfoot-0.
|
|
91
|
-
trenchfoot-0.
|
|
92
|
-
trenchfoot-0.
|
|
88
|
+
trenchfoot-0.4.0.dist-info/METADATA,sha256=s9T-HDufdDA7KVJXq6yZUlicXX9kabzqfLHdJAS1WWM,5292
|
|
89
|
+
trenchfoot-0.4.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
90
|
+
trenchfoot-0.4.0.dist-info/entry_points.txt,sha256=5TejAGmc4GnNYLn7MhhLtSCNz9240RvzcNaetF4IHfg,119
|
|
91
|
+
trenchfoot-0.4.0.dist-info/licenses/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
|
|
92
|
+
trenchfoot-0.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|