|
| | load_field_module () |
| |
| | eval_selection (expr, names) |
| |
| | read_mesh (path) |
| |
| | selection_mask (tris, groups, expr) |
| |
| | input_segments (pts, tris, sel, expr) |
| |
| | in_selected_region (q, pts, tris, sel) |
| |
| | dist_to_segments (q, a, b, chunk=20000) |
| |
| | complex_arrays (seg_a, seg_b) |
| |
| | grid (pts, delta, res, pad_rel, pad_abs=None, zoom=1.0) |
| |
|
| main () |
| |
Pixel image of the offset's quadratic error E = (Phi - c)^2 over a 2D input mesh.
./visualize_error_field.py two_circles.msh # defaults
./visualize_error_field.py two_circles.msh config.json # delta + selection from it
./visualize_error_field.py two_circles.msh --cap 0.05 --res 800 --save out.png
Needs matplotlib, meshio and numpy -- the same environment visualize_offset.py wants:
/Volumes/Seagate_Drive/offsets_optimization_testing/.venv/bin/python
WHAT IT DOES. Evaluates the potential on a regular grid and draws one pixel per sample,
coloured by value. Nothing else -- no contours, no overlays unless asked for.
--cap V values above V are clamped to V before colouring, so the colour range is
[min, V]. Phi is a BARRIER: it diverges ON the input complex, so a handful of
pixels next to it are orders of magnitude above everything else and take the
whole range uncapped. Default is c^2, which is what E equals where Phi = 0.
--plot `error` (default) draws E = (Phi - c)^2; `phi` draws Phi itself.
--res pixels on the long axis.
WHICH Phi. Both fields, selected with --field (default: the config's offset_field, else
`smooth`, which is the component's own default).
euclidean exact distance to the input complex. Level c = target_distance.
smooth the ipc-toolkit high_order_contact (OGC) potential -- the SAME object the run
uses, reached through the wmtk_offset_field extension module rather than
reimplemented, because a Python approximation of it would be a different field
wearing the same name. Build it with:
cmake --build build --target wmtk_offset_field
and this script finds it in <repo>/build/bin automatically. It is IDENTICALLY
ZERO past dhat = offset_dhat_factor x delta; the exact distance to the complex
(cheap in numpy) is used to skip calling it on samples out there, which is not an
approximation and is most of the grid.
WHICH SEGMENTS. The input complex is derived from the mesh the way the C++ derives it: an edge
whose two incident triangles have different group membership under the selection. With a config,
`offset_selection` is used; without one, the default is every non-ambient group against the rest.
| visualize_error_field.grid |
( |
|
pts, |
|
|
|
delta, |
|
|
|
res, |
|
|
|
pad_rel, |
|
|
|
pad_abs = None, |
|
|
|
zoom = 1.0 |
|
) |
| |
A regular grid over the mesh bbox -> (xs, ys, query points).
pad_abs overrides the relative padding: the smooth field is identically zero past dhat, so
for it there is nothing to see further out than that.
zoom > 1 keeps the same pixel COUNT over a window 1/zoom as wide, centred on the mesh
bounding box -- so it is a real increase in sampling density, not a crop of an image already
computed. The padding is symmetric, so the padded box has the same centre as the mesh.