Wildmeshing Toolkit
Loading...
Searching...
No Matches
Functions | Variables
visualize_triwild Namespace Reference

Functions

 read_obj_curves (path)
 
 read_msh (path)
 
 amips2d (P, T)
 
 _selftest ()
 
 resolve (args)
 
 main ()
 

Variables

tuple C_INPUT = (0.910, 0.525, 0.165)
 
tuple C_ENVELOPE = (0.169, 0.498, 0.831)
 
tuple C_MESH = (0.870, 0.870, 0.885)
 
tuple C_EDGE = (0.380, 0.380, 0.420)
 

Detailed Description

Polyscope viewer for a triwild 2D result: input curves, envelope curves, output mesh.

    ./visualize_triwild.py runs/full/success/10433        # a sweep output directory
    ./visualize_triwild.py input.obj output.msh           # explicit pair
    ./visualize_triwild.py output.msh                     # mesh alone

Needs polyscope, meshio and numpy; see README.md for the venv.

Three layers, each with its own visibility checkbox:

  input curves      the .obj segment network handed to triwild
  envelope curves   the SIMPLIFIED curves, read back out of the .msh
  output mesh       the triangulation, coloured by per-face AMIPS2D energy on request

Given a directory it finds the mesh (`output.msh`, `out.msh`, or the only `*.msh`), then
the input: an `input.obj` beside it, else the path recorded in the run's `config.json`,
which is what makes it work on a sweep `success/<id>/` directory unchanged. The input is
optional -- without it you get the other two layers.

Two things about the data that the obvious implementation gets wrong:

* **The .msh node array is not the mesh.** Gmsh entities own their nodes, so a triwild
  output holds two disjoint blocks: the dim-2 entity's nodes are the mesh vertices, and
  the dim-1 "EnvelopeSurface" entity's nodes are the simplified input curve. Handing the
  whole array to register_surface_mesh draws the mesh plus several hundred unreferenced
  stray vertices. Each entity is compacted onto the nodes it actually uses.

* **An OBJ `l` record is a polyline, not a segment** -- n indices mean n-1 segments. The
  2D dataset uses both forms, so reading one segment per record silently drops most of
  the network on the files that use long polylines.

What is deliberately NOT here: which output EDGES are constrained (tracked to the
curves). The .msh does not tag them, and inferring them by proximity would be a guess
presented as data.

Function Documentation

◆ amips2d()

visualize_triwild.amips2d (   P,
  T 
)
Per-triangle AMIPS2D energy and orientation determinant.

Transcribed from wmtk::AMIPS2D_energy (src/wmtk/utils/AMIPS2D.cpp). The floor is 2,
an equilateral triangle -- asserted at startup by _selftest, and cross-checked
against a run's report.json, whose max_energy this reproduces exactly.

wmtk substitutes MAX_ENERGY = 1e50 for a triangle that is inverted or degenerate,
which is what the 1e+50 readings in out.log are. Here the raw expression is returned
and the determinant handed back separately, so an inverted triangle stays visible as
a number rather than collapsing to a sentinel.

◆ read_msh()

visualize_triwild.read_msh (   path)
(mesh points, triangles, envelope points, envelope segments) from a triwild .msh.

◆ read_obj_curves()

visualize_triwild.read_obj_curves (   path)
Vertices and segments of an .obj holding a segment network.

◆ resolve()

visualize_triwild.resolve (   args)
Turn the command line into (obj path or None, msh path).