2#include <wmtk/TriMesh.h>
3#include <wmtk/TriOptimizerMesh.h>
13#include <wmtk/optimization/EnergySum.hpp>
14#include <wmtk/optimization/solver.hpp>
15#include <wmtk/threading/enumerable_thread_specific.hpp>
16#include "OffsetPotential.hpp"
17#include "Parameters.h"
18#include "SimplicialComplexBVH.hpp"
19#include "TagEnvelopes.hpp"
21using CellTag = std::set<int64_t>;
23namespace wmtk::components::topological_offset {
26const int64_t TEMP_OFFSET_TRI_TAG = -1;
27const CellTag TEMP_OFFSET_TRI_TAG_SET{TEMP_OFFSET_TRI_TAG};
41 bool m_is_on_input =
false;
42 bool m_is_on_offset =
false;
43 bool m_is_on_region =
false;
47 bool m_turn_start_valid =
false;
94 std::array<Eigen::Vector2d, 3> rest_pos;
113 enum class EdgeSplitMode {
122 std::array<size_t, 3> m_init_counts = {{0, 0, 0}};
208 void init_region_potentials(
double delta,
double effective_factor);
214 int vertex_region(
const size_t vid)
const
218 int edge_region(
const size_t va,
const size_t vb)
const
220 const int a = vertex_region(va), b = vertex_region(vb);
221 return (a >= 0 && a == b) ? a : -1;
223 const OffsetPotential2D& potential_for_region(
const int region)
const
229 const OffsetPotential2D& potential_for(
const size_t vid)
const
231 return potential_for_region(vertex_region(vid));
237 const int r = vertex_region(vid);
241 const OffsetPotential2D& potential_for_edge(
const size_t va,
const size_t vb)
const
243 return potential_for_region(edge_region(va, vb));
245 const OffsetPotential2D& potential_for_face(
const size_t fid)
const
283 std::vector<Eigen::Vector2i>
E;
290 std::map<int64_t, TagPolyline2d> m_tag_polyline;
299 mutable std::mutex m_isect_mutex;
324 std::shared_ptr<SampleEnvelope>
containment_for(uint64_t region_mask,
bool on_offset)
const;
373 bool walk_along_curve(int64_t tag,
const Vector2d& x,
double s, Vector2d& out)
const;
382 bool curve_tangent(int64_t tag,
const Vector2d& x,
const Vector2d& prefer, Vector2d& tau)
const;
480 EdgeSplitMode m_edge_split_mode = EdgeSplitMode::Midpoint;
483 std::map<std::string, int64_t> m_tag_name_to_id;
484 std::map<int64_t, std::string> m_tag_id_to_name;
485 CellTag m_offset_output_tag_ids;
488 bool m_singlebody =
false;
489 int64_t m_single_tag;
492 bool m_has_envelope =
false;
493 MatrixXd m_V_envelope;
494 MatrixXi m_F_envelope;
508 static constexpr int OFFSET_SURFACE_CLASS = 1;
526 NUM_THREADS = _num_threads;
533 optimization::deactivate_opt_logger();
546 m_vertex_attribute[vid].m_posf = p;
547 m_vertex_attribute[vid].m_pos = to_rational(p);
548 m_vertex_attribute[vid].m_is_rounded =
true;
555 return m_edge_attribute[eid].m_is_surface_fs &&
556 m_edge_attribute[eid].m_surface_class == OFFSET_SURFACE_CLASS;
563 return m_edge_attribute[eid].m_is_surface_fs &&
564 m_edge_attribute[eid].m_surface_class != OFFSET_SURFACE_CLASS;
586 void restore_edge(
const size_t eid,
const EdgeSnapshot2d& s)
588 m_edge_attribute[eid] = s.tags;
589 m_edge_extra[eid] = s.extra;
591 FaceSnapshot2d face_snapshot(
const size_t fid)
const
593 return FaceSnapshot2d{m_face_attribute[fid], m_face_extra[fid]};
595 void restore_face(
const size_t fid,
const FaceSnapshot2d& s)
597 m_face_attribute[fid] = s.attrs;
598 m_face_extra[fid] = s.extra;
660 void log_worst_dist_vertex()
const;
689 mutable std::map<std::string, std::vector<size_t>> m_debug_pvd_series;
698 mutable int m_debug_last_round = -1;
699 mutable char m_debug_last_phase =
'?';
710 double m_quality_max_amips = 0.;
715 std::atomic<int> iter_cnt_recollapsed{0};
716 std::atomic<int> iter_cnt_recollapsed_same_pass{0};
717 std::atomic<int> iter_cnt_split = 0, iter_cnt_collapse = 0, iter_cnt_swap = 0;
718 std::atomic<int> iter_cnt_collapse_offset_removed{0};
721 std::atomic<int> iter_cnt_swap_offset_reject{0};
728 std::atomic<int> iter_cnt_split_offset{0};
735 std::map<size_t, int> face_label;
753 bool marching_split_edge_before(
const Tuple& t);
754 bool marching_split_edge_after(
const Tuple& t);
771 const Vector2d& p_in,
772 const Vector2d& p_out,
774 size_t& steps)
const;
779 size_t m_marching_trace_steps = 0, m_marching_trace_steps_max = 0;
803 bool collapse_before_vertex(
size_t v1,
size_t v2)
override;
804 void collapse_after_vertex(
size_t v1,
size_t v2)
override;
805 void split_after_vertex(
size_t v_new)
override;
846 return !m_vertex_attribute[vid].on_bbox_faces.empty();
848 bool edge_is_on_domain_boundary(
const size_t eid)
const
850 return m_edge_attribute[eid].m_is_bbox_fs >= 0;
917 std::atomic<long long> res_after_nano{0};
918 std::atomic<long long> res_max_before_nano{0};
919 std::atomic<long long> res_max_after_nano{0};
923 for (std::atomic<int>* c :
936 for (std::atomic<long long>* c :
937 {&
res_before_nano, &res_after_nano, &res_max_before_nano, &res_max_after_nano}) {
942 SmoothTrace m_smooth_trace;
960 mutable std::atomic<size_t> m_needle_smooth_offered{0};
961 mutable std::atomic<size_t> m_needle_smooth_reached{0};
962 mutable std::atomic<size_t> m_needle_smooth_fixed{0};
963 mutable std::atomic<size_t> m_needle_smooth_stationary{0};
993 void record_flatness(
const char* op,
double parent_flat,
size_t child_fid)
const;
994 mutable std::atomic<size_t> m_flat_created_split{0};
995 mutable std::atomic<size_t> m_flat_created_collapse{0};
996 mutable std::atomic<size_t> m_flat_worsened_split{0};
997 mutable std::atomic<size_t> m_flat_genesis_reports{0};
998 static constexpr double kFlatThreshold = 1e-3;
1042 void log_smooth_trace()
const;
1102 return m_vertex_extra[vid].m_is_on_region || !m_vertex_attribute[vid].on_bbox_faces.empty();
1110 for (
const int64_t t : tags) {
1112 if (it !=
m_tag_bit.end()) bits |= (uint64_t(1) << it->second);
1153 const std::optional<Tuple> opp = e.switch_face(*
this);
1155 return tag_bits(m_face_attribute[e.fid(*
this)].tags);
1157 const auto& t0 = m_face_attribute[e.fid(*
this)].tags;
1158 const auto& t1 = m_face_attribute[opp->fid(*
this)].tags;
1160 std::set_symmetric_difference(
1165 std::inserter(diff, diff.begin()));
1197 const std::array<size_t, 2>& vids)
const override
1210 bool all_offset =
true;
1211 for (
const size_t v : vids) {
1212 all_offset = all_offset && m_vertex_extra[v].m_is_on_offset;
1229 if (mask != 0 && all_offset) {
1231 const size_t eid = std::get<1>(*found);
1232 if (m_edge_attribute[eid].m_is_surface_fs) {
1244 const std::shared_ptr<SampleEnvelope> base =
containment_for(mask, all_offset);
1300 std::shared_ptr<SampleEnvelope> best;
1301 double worst_d2 = -1.;
1304 if (it ==
m_tag_bit.end() || !(mask & (uint64_t(1) << it->second)))
continue;
1307 if ((mask & (mask - 1)) == 0)
break;
1308 worst_d2 = env->squared_distance(m_vertex_attribute[vid].m_posf);
1311 const double d2 = env->squared_distance(m_vertex_attribute[vid].m_posf);
1312 if (d2 > worst_d2) {
1401 return std::isfinite(ratio) && ratio <= 1.;
1409 static_cast<size_t>(-1);
1416 const Vector2d& x)
const;
1422 const size_t vid)
const override
1424 std::shared_ptr<polysolve::nonlinear::Problem> front;
1430 if (!front)
return rest;
1431 if (!rest)
return front;
1432 auto sum = std::make_shared<optimization::EnergySum>();
1433 sum->add_energy(front);
1434 sum->add_energy(rest);
1452 mutable std::atomic<bool> m_released_tube_dirty{
false};
1453 mutable std::mutex m_released_mutex;
1468 bool face_is_plastic(
size_t fid)
const
1499 const std::shared_ptr<const OffsetPotential2D>& pot)
const;
1529 return m_phase != OptPhase::B ? wmtk::TriOptimizerMesh::optimization_stop_metric() : 1.;
1608 double max_reachable = 0., avg_reachable = 0.;
1609 double max_pinned = 0.;
1610 size_t n_reachable = 0, n_pinned = 0;
1620 size_t worst_outside_vid =
static_cast<size_t>(-1);
1621 double worst_outside_dist = 0.;
1677 template <
typename Visit>
1682 const Vector2d p0 = m_vertex_attribute[e.vid(*
this)].m_posf;
1683 const Vector2d p1 = m_vertex_attribute[e.switch_vertex(*this).vid(*
this)].m_posf;
1684 for (
int i = 1; i <= k; ++i) {
1685 const double t = double(i) / double(k + 1);
1686 visit(Vector2d((1. - t) * p0 + t * p1));
1709 double max_reachable = 0., avg_reachable = 0.;
1710 double max_pinned = 0.;
1711 size_t n_reachable = 0, n_pinned = 0;
1758 size_t n_vertices = 0, n_edges = 0, n_unmeasurable = 0;
1759 size_t worst_vid =
static_cast<size_t>(-1);
1760 Vector2d worst_edge_mid = Vector2d::Zero();
1768 double max_edge_placed = 0.;
1769 Vector2d worst_placed_mid = Vector2d::Zero();
1779 Vector2d worst_at_floor_mid = Vector2d::Zero();
1787 Vector2d worst_corners_at_floor_mid = Vector2d::Zero();
1790 bool floor_from_min_edge_length =
false;
1799 std::vector<Refinable> refinable;
1814 static const char* ring_name() {
return "length-weighted ring measure"; }
1816 size_t n_rings = 0, n_rings_unmeasurable = 0;
1817 size_t worst_ring_vid =
static_cast<size_t>(-1);
1826 Vector2d worst_ring_at_floor_pos = Vector2d::Zero();
1827 bool rings_ok()
const {
return max_ring <= bar; }
1833 bool edges_ok()
const {
return max_edge <= bar; }
1859 return (
ring_exit ? rings_ok() : edges_ok()) && n_unmeasurable == 0;
1867 double ratio()
const {
return bar > 0. ? std::max(max_vertex,
max_edge) / bar : 0.; }
1869 EnergyCriterion energy_criterion();
1874 double front_chord_target(
size_t va,
size_t vb,
double len,
double sag,
double tube)
const;
1894 void grade_sizing(
double grade,
const std::vector<size_t>& seeds);
1909 size_t front_worst_vid =
static_cast<size_t>(-1);
1916 size_t background_worst_vid =
static_cast<size_t>(-1);
1917 size_t n_background = 0;
2071 if (!is_surface_flip) {
2072 return after < before;
2074 return after <
m_params.stop_energy;
2077 mutable std::atomic<size_t> m_deg_split_created{0};
2078 mutable std::atomic<size_t> m_deg_collapse_offered{0};
2079 mutable std::atomic<size_t> m_deg_collapse_allowed{0};
2080 mutable std::atomic<size_t> m_deg_collapse_by_ringmax{0};
2081 mutable std::atomic<size_t> m_deg_collapse_by_stop{0};
2082 mutable std::atomic<size_t> m_deg_collapse_by_unrounded{0};
2098 void report_needle(
const char* op,
size_t fid,
double parent_q)
const;
2099 static constexpr size_t kNeedleReports = 12;
2109 mutable std::atomic<size_t> m_needle_reports{0};
2121 size_t m_stuck_calls = 0;
2157 const char ph = (
m_phase == OptPhase::A) ?
'A' : (
m_phase == OptPhase::B ?
'B' :
'S');
2158 if (
m_ab_round != m_debug_last_round || ph != m_debug_last_phase) {
2160 m_debug_last_phase = ph;
2166 std::string label = path;
2167 if (path.rfind(
"debug_", 0) == 0) {
2168 label = fmt::format(
2174 }
else if (path.rfind(
"phase_", 0) == 0) {
2175 label = fmt::format(
"r{}{}_end",
m_ab_round, ph);
2203 const MatrixSi& F_tags,
2204 const MatrixXd& V_env,
2205 const MatrixXi& F_env,
2206 const std::vector<std::string>& tag_names,
2207 const std::string& curve_name =
"");
2249 std::vector<int> m_phi_P;
2256 bool invariants(
const std::vector<Tuple>& tris)
override;
2317 void write_input_complex(
const std::string& path);
2318 void write_vtu(
const std::string& path);
2320 void write_msh_groups(
const std::string& file);
2338 std::map<simplex::Edge, EdgeSnapshot2d> existing_eattr;
2341 std::map<size_t, FaceSnapshot2d> opp_v_fattr;
2353 std::map<simplex::Edge, EdgeSnapshot2d> existing_eattr;
2364 for (
const int64_t& i : tag1) {
2365 if (tag2.find(i) != tag2.end()) {
2381 double len1 = (m_vertex_attribute[e1.vertices()[0]].m_posf -
2382 m_vertex_attribute[e1.vertices()[1]].m_posf)
2384 double len2 = (m_vertex_attribute[e2.vertices()[0]].m_posf -
2385 m_vertex_attribute[e2.vertices()[1]].m_posf)
2397 const auto& verts = e.vertices();
2398 const auto incident = simplex_incident_triangles(e);
2399 const auto& faces = incident.faces();
2401 assert(!faces.empty());
2403 const size_t f_id = tuple_from_simplex(faces.front()).
fid(*
this);
2405 return t_edge.eid(*
this);
2413 const auto& v = e.vertices();
2414 const auto faces = simplex_incident_triangles(e).faces();
2415 assert(!faces.empty());
2416 const size_t fid = tuple_from_simplex(faces.front()).
fid(*
this);
2425 std::vector<Tuple> adj_tris;
2428 adj_tris.push_back(tri_1.value());
2432 adj_tris.push_back(tri_2.value());
2436 adj_tris.push_back(tri_3.value());
Whether a codimension-1 simplex is tracked surface, and which bbox side it lies on.
Definition SurfaceTagAttributes.h:15
size_t fid(const TriMesh &) const
Definition TriMesh.h:80
Tuple switch_vertex(const TriMesh &m) const
Definition TriMesh.cpp:158
Tuple switch_edge(const TriMesh &m) const
Definition TriMesh.cpp:187
std::optional< Tuple > switch_face(const TriMesh &m) const
Definition TriMesh.cpp:214
std::optional< std::tuple< Tuple, size_t > > try_tuple_from_edge(const std::array< size_t, 2 > &vids) const
tuple_from_edge for callers where a missing edge is an answer, not a bug.
Definition TriMesh.cpp:2042
Tuple tuple_from_edge(size_t vid1, size_t vid2, size_t fid) const
Definition TriMesh.cpp:2202
What triwild and simwild's 2D mesh share.
Definition TriOptimizerMesh.h:39
AttributeContainerGroup m_edge_attr_group
What p_edge_attrs points at, so a derived class can register more.
Definition TriOptimizerMesh.h:111
AttributeContainerGroup m_vertex_attr_group
What p_vertex_attrs points at, so a derived class can register more.
Definition TriOptimizerMesh.h:96
AttributeContainerGroup m_face_attr_group
What p_face_attrs points at, so a derived class can register more.
Definition TriOptimizerMesh.h:122
OptimizerParameters & m_params
Definition TriOptimizerMesh.h:136
std::string m_debug_pass_name
Definition TriOptimizerMesh.h:158
The offset potential: the scalar field on space whose level set the front is placed on.
Definition OffsetPotential.hpp:37
The offset's 2D mesh, on the shared 2D optimizer.
Definition TopoOffsetTriMesh.h:111
void rebuild_offset_envelope()
Definition Optimize2d.cpp:3881
std::pair< double, double > compute_distance_deviation() const
How far the offset boundary is from where it should be: {max, avg} over vertices.
Definition Optimize2d.cpp:3379
void stamp_plastic_rests()
Stamp rest := current for every plastic face; called before every operation group.
Definition Optimize2d.cpp:360
void stamp_rest_face(size_t fid)
Definition Optimize2d.cpp:351
double offset_edge_sag(size_t a, size_t b) const
Definition Optimize2d.cpp:750
int m_n_regions
One field per connected piece of the input complex, and which one each band vertex is placed on.
Definition TopoOffsetTriMesh.h:200
int64_t tangent_curve_tag(size_t vid, const Vector2d &x) const
Which tag's boundary curve a vertex slides along, or -1.
Definition Optimize2d.cpp:507
int m_debug_pass
Definition TopoOffsetTriMesh.h:697
void label_input_complex()
label input complex simplices as per boolean expression (or single body mode)
Definition TopoOffsetTriMesh.cpp:406
double edge_interpolation_residual(const Tuple &e) const
The interpolation residual of front edge e, see EnergyCriterion. -1 when unmeasurable.
Definition Optimize2d.cpp:2508
void set_vertex_position(const size_t vid, const Vector2d &p)
Place a vertex, keeping its exact and rounded coordinates in step.
Definition TopoOffsetTriMesh.h:544
std::string envelope_key_name(int64_t tag) const
The name a tag or pseudo-tag prints under.
Definition TopoOffsetTriMesh.cpp:210
void assign_band_regions(bool log=true)
Definition Optimize2d.cpp:2889
Parameters & m_offset_params
The base holds only wmtk::OptimizerParameters; this is the same object, typed.
Definition TopoOffsetTriMesh.h:511
double band_vertex_distance_error(const size_t vid) const
Definition Optimize2d.cpp:2301
void write_smoothing_debug_output(const std::string &path) const override
Put the optimization's frames on the run's single debug timeline (see write_debug_frame()),...
Definition TopoOffsetTriMesh.h:2155
int stencil_order() const
Definition TopoOffsetTriMesh.h:1534
std::atomic< int > m_placement_tangential
Definition TopoOffsetTriMesh.h:1089
void log_front_profile(size_t vid)
Diagnostic: the front objective of one vertex along its normal, offset term vs total.
Definition Optimize2d.cpp:2996
void audit_surface_containment(const std::string &when) const
Which tracked edges are outside their envelope, and by how much.
Definition Optimize2d.cpp:1168
double optimization_stop_metric() const override
1.0 in Phase B, where the metric is normalized; the base's stop_energy in Phase A.
Definition TopoOffsetTriMesh.h:1526
void needle_scan(const char *when) const
Definition Optimize2d.cpp:2010
void log_stuck_refine_census(double max_metric, double filter_energy)
Why Phase A is stuck: a census of the faces stuck-refine is about to chase.
Definition Optimize2d.cpp:1728
std::shared_ptr< polysolve::nonlinear::Problem > smoothing_extra_energy(const size_t vid) const override
Definition TopoOffsetTriMesh.h:1421
bool split_face_before(const Tuple &t) override
User specified preparations and desideratas for a face split.
Definition EdgeSplittingTri.cpp:248
std::atomic< int > iter_cnt_collapse_guard_reject
Definition TopoOffsetTriMesh.h:725
SmoothingProgress smoothing_progress(const std::vector< Vector2d > &before)
Measure a pass: before holds every live vertex's position before it, indexed by vid.
Definition Optimize2d.cpp:3151
std::set< int64_t > m_source_tags
Definition TopoOffsetTriMesh.h:1444
Vector2d front_vertex_move_direction(size_t vid) const
Definition FrontSmooth2d.cpp:192
void set_offset_tri_tags()
update 'tags' data for triangles in the offset region (tris labelled 2) based on the given offset tag...
Definition TopoOffsetTriMesh.cpp:1281
size_t refine_front_by_halving(const std::vector< EnergyCriterion::Refinable > &edges)
Definition Optimize2d.cpp:3116
std::map< int64_t, int > m_tag_bit
Definition TopoOffsetTriMesh.h:294
bool front_vertex_alignment_traps_1d_solve(size_t vid) const
Definition FrontSmooth2d.cpp:231
bool vertex_is_on_surface(const size_t vid) const override
The substructure the link condition is evaluated against, derived not cached.
Definition Optimize2d.cpp:55
std::vector< int64_t > m_phi_point_region
per m_phi_P entry: region index, -1 unknown
Definition TopoOffsetTriMesh.h:205
std::atomic< int > m_placement_env_entry_outside
Definition TopoOffsetTriMesh.h:1077
bool band_vertex_is_reachable(const size_t vid) const
Definition TopoOffsetTriMesh.h:1960
bool collapse_quality_allowed(size_t v1, size_t v2, double q, double ring_max) const override
Instrumentation only: which operation manufactures the MAX_ENERGY needles.
Definition Optimize2d.cpp:1928
size_t refine_front_from_sag(const std::vector< EnergyCriterion::Refinable > &edges)
Definition Optimize2d.cpp:3079
bool offset_is_manifold()
verify that the closed offset region (simplices labelled 1 or 2) form a manifold region....
Definition TopoOffsetTriMesh.cpp:1316
void report_needle(const char *op, size_t fid, double parent_q) const
Where the first needles come from – a tripwire, not a census.
Definition Optimize2d.cpp:1957
void optimize_offset(const std::filesystem::path &output_file)
The 2D optimization phase: split / collapse / swap / smooth on the shared driver.
Definition Optimize2d.cpp:4386
void report_outside_support(const char *when, const DistanceSplit &s) const
Definition Optimize2d.cpp:3358
std::shared_ptr< SampleEnvelope > m_released_envelope
Definition TopoOffsetTriMesh.h:1451
double offset_residual_tolerance() const
Definition TopoOffsetTriMesh.h:1542
GradientSplit gradient_split(bool include_edge_samples=true) const
Definition Optimize2d.cpp:2393
std::shared_ptr< SampleEnvelope > released_envelope() const
Definition Optimize2d.cpp:3828
double m_gradient_reference
See offset_gradient_tolerance(). Nothing sets it on the single-phase path; it stays 0.
Definition TopoOffsetTriMesh.h:701
std::vector< int64_t > m_phi_vert_region
per m_phi_V row: region index
Definition TopoOffsetTriMesh.h:202
size_t m_worst_dist_vid
Definition TopoOffsetTriMesh.h:659
std::atomic< int > iter_cnt_split_offset_before
Splits of an offset-boundary edge: offered, accepted.
Definition TopoOffsetTriMesh.h:727
bool front_placed_by_ratio(const double ratio) const
Definition TopoOffsetTriMesh.h:1399
std::array< size_t, 6 > m_deg_prev_counts
Values at the previous census, so each census can report deltas rather than totals.
Definition TopoOffsetTriMesh.h:2084
size_t m_debug_seq
Monotonic frame counter for the debug timeline. Mutable because the write hook is const.
Definition TopoOffsetTriMesh.h:684
EdgeSamples offset_edge_samples(const Tuple &e) const
The Phi residual at stencil_order interior points of band edge e.
Definition Optimize2d.cpp:2317
bool empty_input_complex()
check if the input complex is empty. Only valid after calling init_from_image(...)....
Definition TopoOffsetTriMesh.cpp:588
void build_boundary_envelopes(const char *when, EnvelopeSetup setup)
Definition TopoOffsetTriMesh.cpp:230
bool smooth_plastic_vertex(const Tuple &t)
Definition Optimize2d.cpp:376
OptPhase m_phase
Which phase is running. Read by every hook that differs between them; see OptPhase.
Definition TopoOffsetTriMesh.h:402
std::shared_ptr< SimplicialComplexBVH > m_input_complex_bvh
The input complex as loaded. Built once, never rebuilt.
Definition TopoOffsetTriMesh.h:158
void init_input_complex_bvh()
Build the input complex's BVH and its smooth offset potential, from one extraction.
Definition TopoOffsetTriMesh.cpp:601
bool face_is_deformable(size_t fid) const
Under deform_others the same set as face_is_plastic(): every face outside the band.
Definition Optimize2d.cpp:325
double front_chord_target(size_t va, size_t vb, double len, double sag, double tube) const
Definition Optimize2d.cpp:3036
bool phase_places_front() const
Definition TopoOffsetTriMesh.h:399
size_t edge_id_from_simplex(const simplex::Edge &e) const
get global id of edge from simplex::Edge object
Definition TopoOffsetTriMesh.h:2395
std::atomic< int > iter_cnt_collapse_offset_reject
Operations refused because they would have left an offset-boundary face over tolerance.
Definition TopoOffsetTriMesh.h:720
void log_refine_block_census(const std::string &when, double filter_energy) const
For every element above filter_energy, why its edges cannot be split.
Definition Optimize2d.cpp:1551
std::map< uint64_t, std::shared_ptr< SampleEnvelope > > m_offset_isect_cache
Memoized "region tubes AND the offset envelope", keyed by the region mask.
Definition TopoOffsetTriMesh.h:312
bool face_is_offset_band(const size_t fid) const
Definition Optimize2d.cpp:2258
Tuple get_tuple_from_edge(const simplex::Edge &e) const
get Tuple simplex::Edge object
Definition TopoOffsetTriMesh.h:2411
std::vector< int > m_vertex_region
per vertex: region of its band faces, -1 / -2 as above
Definition TopoOffsetTriMesh.h:207
Vector2d offset_vertex_normal(const size_t vid) const
The normal at an offset vertex. Every caller that needs one goes through here, so switching the defin...
Definition Optimize2d.cpp:1135
void check_no_vertex_on_both_surfaces(const char *when) const
Definition Optimize2d.cpp:3749
void marching_tris()
Definition TopoOffsetTriMesh.cpp:1147
uint64_t tag_bits(const CellTag &tags) const
Definition TopoOffsetTriMesh.h:1107
void write_debug_pvd() const
Definition Optimize2d.cpp:4032
double gradient_reference() const
Definition TopoOffsetTriMesh.h:1580
void classify_curve_edges()
Mark the mesh edges that lie on the input's curve group (EdgeExtra2d::on_curve).
Definition TopoOffsetTriMesh.cpp:370
double face_flatness(size_t fid) const
Scale-invariant flatness: 2*area / longest_edge^2.
Definition Optimize2d.cpp:2069
bool face_in_region(const size_t fid) const
Whether face fid belongs to the closed offset region, read from its label.
Definition Optimize2d.cpp:65
void sort_edges_by_length(std::vector< simplex::Edge > &edges)
sort vector of edge simplices in place by decreasing length
Definition TopoOffsetTriMesh.h:2375
bool swap_edge_after(const Tuple &t) override
Definition Optimize2d.cpp:664
bool m_freeze_front
The final Phase A: front vertices are not smoothed (see smooth_before()).
Definition TopoOffsetTriMesh.h:409
uint64_t vertex_boundary_mask(const size_t vid) const
The tag boundaries this vertex lies on – the raw mask gated on the vertex still being region geometry...
Definition TopoOffsetTriMesh.h:1127
double front_vertex_normal_gradient(size_t vid) const
Definition Optimize2d.cpp:1151
double max_band_vertex_distance() const
Definition TopoOffsetTriMesh.cpp:952
MatrixXi m_phi_F
the complex faces, in the same vertex index space (for per-region BVHs)
Definition TopoOffsetTriMesh.h:2248
DistanceSplit residual_split() const
Definition Optimize2d.cpp:2338
void write_debug_frame(const std::string &label)
One frame of the run's single debug timeline: <output>_NNNNN.vtu with the next sequence number,...
Definition Optimize2d.cpp:4008
std::vector< bool > band_vertex_mask() const
Definition Optimize2d.cpp:2264
void for_each_offset_edge_sample(const Tuple &e, Visit &&visit) const
Visit the same interior sample points offset_edge_samples() measures on.
Definition TopoOffsetTriMesh.h:1678
std::set< int64_t > m_deform_tags
The released tags. Filled by release_deformable_regions(); empty = feature inactive.
Definition TopoOffsetTriMesh.h:1441
bool ops_guard_refuses_collapse(size_t v1, size_t v2) const
Definition Optimize2d.cpp:771
std::shared_ptr< SampleEnvelope > envelope_for_mask(uint64_t mask) const
The envelope a simplex with this boundary mask is contained in, or null.
Definition Optimize2d.cpp:209
bool m_converged
Definition TopoOffsetTriMesh.h:705
std::vector< std::array< int, 3 > > churn_counts
Definition TopoOffsetTriMesh.h:674
void warn_if_offset_reaches_domain_boundary() const
Warn if the offset band has grown into the domain boundary.
Definition Optimize2d.cpp:176
double edge_conv_ratio(const Tuple &e) const
The edge test divided by its bar (1 = bar), per front_conv_criterion; -1 unmeasurable.
Definition Optimize2d.cpp:2856
double offset_gradient_tolerance() const
The convergence tolerance: the bound on |grad (Phi - c)^2| at a band vertex.
Definition TopoOffsetTriMesh.h:1564
bool edge_is_offset_surface_live(const Tuple &e) const
Definition Optimize2d.cpp:3680
bool split_edge_after(const Tuple &t) override
User specified modifications and desideratas after an edge split.
Definition EdgeSplittingTri.cpp:172
uint64_t edge_boundary_bits(const Tuple &e) const
Diagnostic only: which tag boundaries the incident faces say this edge lies on right now – the same s...
Definition TopoOffsetTriMesh.h:1151
bool vertex_is_on_domain_boundary(const size_t vid) const
Identification only – no operation refuses the domain wall through these.
Definition TopoOffsetTriMesh.h:844
std::vector< std::string > m_debug_frame_labels
Definition TopoOffsetTriMesh.h:688
std::optional< EnergyCriterion > m_energy_verdict
Definition TopoOffsetTriMesh.h:1929
bool invariants(const std::vector< Tuple > &tris) override
User specified invariants that can't be violated.
Definition TopoOffsetTriMesh.cpp:1366
double face_criterion_rel(const size_t fid) const
Definition Optimize2d.cpp:3457
void execute_offset(const std::filesystem::path &output_file)
Definition TopoOffsetTriMesh.cpp:976
double phase_b_front_gradient_linf()
Definition Optimize2d.cpp:2783
std::shared_ptr< const OffsetPotential2D > potential_ptr_for(const size_t vid) const
Definition TopoOffsetTriMesh.h:235
void optimize_offset_single_phase()
TriWild's loop, the front placed inside its smoothing passes.
Definition Optimize2d.cpp:4070
std::vector< char > offset_surface_foldover_labels() const
Per-vertex 0/1: has the offset curve folded back on itself at this vertex? Debug frame diagnostic; se...
Definition Optimize2d.cpp:3702
std::vector< int > m_face_region
per face: band's region, -1 none, -2 reached from two
Definition TopoOffsetTriMesh.h:206
std::set< std::pair< long, long > > m_stuck_prev_cells
Definition TopoOffsetTriMesh.h:2120
void init_from_image(const MatrixXd &V, const MatrixXi &F, const MatrixSi &F_tags, const MatrixXd &V_env, const MatrixXi &F_env, const std::vector< std::string > &tag_names, const std::string &curve_name="")
initialize TriMesh from vertex, face, tag data
Definition TopoOffsetTriMesh.cpp:13
void check_offset_within_support(const char *when) const
Stop the run if any reachable band vertex has left the potential's support.
Definition Optimize2d.cpp:3353
bool project_into_containment(size_t vid, Vector2d &x) const
Move x back inside every region tube this vertex lies on. True if it ended up inside all of them.
Definition Optimize2d.cpp:278
std::shared_ptr< OffsetPotential2D > m_offset_potential
The smooth offset potential, and with it the definition of the offset itself.
Definition TopoOffsetTriMesh.h:169
MatrixXd m_curve_V
The curve group as loaded, kept because the classification below is redone on demand.
Definition TopoOffsetTriMesh.h:129
std::vector< int64_t > m_phi_seg_region
per m_phi_E row: region index, -1 unknown
Definition TopoOffsetTriMesh.h:203
int64_t m_curve_tag
Definition TopoOffsetTriMesh.h:127
static constexpr int INPUT_SURFACE_CLASS
SurfaceTagAttributes::m_surface_class: which of the two tracked surfaces an edge belongs to....
Definition TopoOffsetTriMesh.h:507
bool smooth_before(const Tuple &t) override
User specified preparations and desideratas for an edge smooth.
Definition Optimize2d.cpp:1006
MatrixXd m_phi_V
Definition TopoOffsetTriMesh.h:2246
std::shared_ptr< SampleEnvelope > surface_envelope_for_edge(const std::array< size_t, 2 > &vids) const override
Class-0 segments – every region boundary, the input complex and the domain wall included – carry a co...
Definition TopoOffsetTriMesh.h:1196
uint64_t edge_mask(const std::array< size_t, 2 > &vids) const
Definition TopoOffsetTriMesh.h:1134
bool smoothing_position_is_allowed(const size_t, const Vector2d &) const override
No per-vertex positional constraint. The per-tag envelopes close that hole structurally – the same de...
Definition TopoOffsetTriMesh.h:1270
static constexpr int64_t m_wall_tag
pseudo-tag: the domain wall's tube
Definition TopoOffsetTriMesh.h:434
bool split_edge_before(const Tuple &t) override
User specified preparations and desideratas for an edge split.
Definition EdgeSplittingTri.cpp:9
bool split_face_after(const Tuple &t) override
User specified modifications and desideratas after a face split.
Definition EdgeSplittingTri.cpp:282
bool face_is_released_band(size_t fid) const
Definition Optimize2d.cpp:332
void record_flatness(const char *op, double parent_flat, size_t child_fid) const
Genesis: flatness transitions recorded at the operation hooks. {op, parent, child}.
Definition Optimize2d.cpp:2081
void mark_input_complex_vertices()
Definition TopoOffsetTriMesh.cpp:339
std::shared_ptr< polysolve::nonlinear::Problem > phase_b_front_objective(size_t vid, const Vector2d &x) const
Definition FrontSmooth2d.cpp:302
double front_move_alignment(size_t vid) const
Definition FrontSmooth2d.cpp:173
bool front_vertex_placed(size_t vid) const
THE definition of "placed" for a vertex on the offset surface.
Definition Optimize2d.cpp:2849
std::atomic< size_t > m_needle_smooth_reports
Worst-case record: the best (lowest) ring max any needle-adjacent smooth achieved.
Definition TopoOffsetTriMesh.h:965
void smooth_group_to_convergence(const char *group_name)
Definition Optimize2d.cpp:3193
double m_front_gradient_reference
Definition TopoOffsetTriMesh.h:478
std::shared_ptr< SampleEnvelope > containment_for(uint64_t region_mask, bool on_offset) const
The containment a simplex with this region mask, on/off the offset front, must satisfy – the intersec...
Definition Optimize2d.cpp:249
std::vector< std::shared_ptr< OffsetPotential2D > > m_region_potentials
one per piece
Definition TopoOffsetTriMesh.h:201
std::atomic< int > iter_cnt_split_born
Definition TopoOffsetTriMesh.h:714
bool vertex_is_on_region(const size_t vid) const
Is this vertex on a region boundary – a tag boundary, or the domain wall.
Definition TopoOffsetTriMesh.h:1100
wmtk::threading::enumerable_thread_specific< double > m_collapse_parent_flatness
The flattest face in the collapse's ring before it ran, for record_flatness().
Definition TopoOffsetTriMesh.h:1000
double front_vertex_conv_ratio(size_t vid) const
Definition Optimize2d.cpp:2804
bool edge_is_on_surface(const std::array< size_t, 2 > &vids) const override
Is an edge part of the substructure.
Definition Optimize2d.cpp:38
bool any_tag_present(const CellTag &tag1, const CellTag &tag2) const
determine if any tag from tag1 is also present in tag2.
Definition TopoOffsetTriMesh.h:2362
Vector2d front_vertex_normal(size_t vid) const
The field's outward unit direction at front vertex vid (zero where grad Phi vanishes).
Definition FrontSmooth2d.cpp:224
size_t refine_sizing_around_worst(double max_metric) override
TriWild's stall-driven sizing refinement, verbatim.
Definition Optimize2d.cpp:3479
std::vector< int64_t > m_phi_face_region
per m_phi_F row: region index, -1 unknown
Definition TopoOffsetTriMesh.h:204
static constexpr double kNeedleQuality
What counts as a needle for the tripwire – deliberately far below MAX_ENERGY.
Definition TopoOffsetTriMesh.h:2108
std::shared_ptr< polysolve::nonlinear::Problem > phase_b_front_energy(size_t vid, const std::shared_ptr< const OffsetPotential2D > &pot) const
Definition FrontSmooth2d.cpp:350
std::map< int64_t, std::shared_ptr< SampleEnvelope > > m_tag_envelopes
One containment envelope per input tag, ambient included. Both phases.
Definition TopoOffsetTriMesh.h:266
std::map< uint64_t, std::shared_ptr< SampleEnvelope > > m_isect_cache
Definition TopoOffsetTriMesh.h:298
bool edge_split_sphere_trace(const Vector2d &p_in, const Vector2d &p_out, Vector2d &p_new, size_t &steps) const
Construction placement under sphere_trace_initialization: sphere tracing along the edge from p_in (th...
Definition EdgeSplittingTri.cpp:138
bool optimization_bare_coarsen_passes() const override
Definition TopoOffsetTriMesh.h:2130
void label_offset_boundary()
Tag the two tracked surfaces for the optimization phase.
Definition Optimize2d.cpp:75
bool edge_borders_released_boundary(const Tuple &e) const
Definition Optimize2d.cpp:3804
bool edge_is_region(const size_t eid) const
Definition TopoOffsetTriMesh.h:561
bool curve_tangent(int64_t tag, const Vector2d &x, const Vector2d &prefer, Vector2d &tau) const
The unit tangent of tag tag's curve at x's foot, or false if there is none.
Definition Optimize2d.cpp:526
void append_frame_label(size_t idx, const std::string &label) const
One line of <output>_frames.txt; truncates the file on the first frame.
Definition Optimize2d.cpp:4000
double band_vertex_residual(const size_t vid) const
Definition Optimize2d.cpp:2310
std::vector< std::array< double, 8 > > optimization_metrics
Definition TopoOffsetTriMesh.h:671
void simplicial_embedding()
make mesh a simplicial embedding of the input complex (simplices labelled 1)
Definition TopoOffsetTriMesh.cpp:1084
bool edge_is_offset(const size_t eid) const
Definition TopoOffsetTriMesh.h:553
static constexpr int64_t m_complex_tag
Definition TopoOffsetTriMesh.h:435
std::tuple< double, double > optimization_quality_stats() override
The loop's convergence metric, normalized so that 1.0 means "done".
Definition Optimize2d.cpp:3425
bool swap_edge_before(const Tuple &t) override
Reject a flip whose new edge already exists.
Definition Optimize2d.cpp:134
bool face_is_input_complex(const size_t fid) const
Definition Optimize2d.cpp:70
double max_offset_edge_sag(const std::vector< std::array< size_t, 2 > > &edges) const
Definition Optimize2d.cpp:762
void log_region_edge_mask_health(const std::string &when) const
Are the tracked region boundaries actually contained by anything?
Definition Optimize2d.cpp:1333
size_t grade_sizing_by_distance(const std::vector< size_t > &seeds)
Definition Optimize2d.cpp:3250
bool smooth_after(const Tuple &t) override
User specified modifications and desideras after an edge smooth.
Definition Optimize2d.cpp:1038
bool collapse_edge_after(const Tuple &t) override
A collapse is accepted by the same criterion the smoothing minimises.
Definition Optimize2d.cpp:678
void needle_forensics() const
The full post-mortem on why nothing removes the flat faces.
Definition Optimize2d.cpp:2133
bool walk_along_curve(int64_t tag, const Vector2d &x, double s, Vector2d &out) const
March s of arclength along tag tag's boundary polyline from x's foot on it.
Definition Optimize2d.cpp:574
bool split_adjust_position(size_t v_new, const std::vector< Tuple > &children) override
Carry each parent's region label onto the two children it became.
Definition Optimize2d.cpp:953
size_t m_marching_root_splits
Definition TopoOffsetTriMesh.h:778
wmtk::threading::enumerable_thread_specific< double > m_collapse_survivor_sizing
Definition TopoOffsetTriMesh.h:1003
std::vector< Tuple > get_edge_adjacent_faces(const Tuple &f) const
get faces (as Tuples) that are edge-adjacent to the given face (as Tuple)
Definition TopoOffsetTriMesh.h:2423
std::vector< std::array< int, 3 > > op_counts
Definition TopoOffsetTriMesh.h:679
std::vector< Eigen::Vector2d > m_env_polyline_V
Definition TopoOffsetTriMesh.h:289
wmtk::threading::enumerable_thread_specific< std::pair< double, Vector2d > > m_needle_pre
Why smoothing does not lift a sliver's apex off its opposite edge.
Definition TopoOffsetTriMesh.h:959
void collapse_pass_begin() override
Definition Optimize2d.cpp:877
int m_ab_round
Definition TopoOffsetTriMesh.h:682
void init_surfaces_and_boundaries()
Classify every region boundary, build the per-tag containment envelopes, and tag the domain wall – on...
Definition TopoOffsetTriMesh.cpp:140
void release_deformable_regions()
Definition Optimize2d.cpp:438
bool m_quality_converged
Definition TopoOffsetTriMesh.h:709
bool m_plastic_active
set in optimize_offset() when deform_others
Definition TopoOffsetTriMesh.h:1467
double ring_max_quality(size_t vid) const
Max AMIPS over the faces incident to vid. -1 if it has none.
Definition Optimize2d.cpp:2059
void write_phi_grid(const std::string &path, int n) const
Sample the smooth offset potential on a dense grid and write it as <path>_phi.vtu.
Definition TopoOffsetTriMesh.cpp:1700
void grade_sizing(double grade, const std::vector< size_t > &seeds)
Definition Optimize2d.cpp:3240
EnvelopeSetup
Which boundaries the region-class envelopes hold, and how they are built.
Definition TopoOffsetTriMesh.h:429
bool ambient_assert()
ensure ambient tag does not overlap any other tags in mesh.
Definition TopoOffsetTriMesh.cpp:356
std::shared_ptr< SampleEnvelope > smoothing_containment_envelope(const size_t vid) const override
... and it is not contained by one either, except in Phase A.
Definition TopoOffsetTriMesh.h:1331
size_t m_front_gradient_worst_vid
Definition TopoOffsetTriMesh.h:1408
bool edge_is_complex_boundary(const Tuple &e) const
Definition TopoOffsetTriMesh.cpp:218
OptPhase
Which mode the hooks are running in. The 2D twin of TopoOffsetTetMesh::OptPhase.
Definition TopoOffsetTriMesh.h:395
bool is_simplicially_embedded() const
check if the input complex (simplices labelled 1) are simplicially embedded w.r.t....
Definition TopoOffsetTriMesh.cpp:1039
std::shared_ptr< SampleEnvelope > smoothing_energy_envelope(const size_t vid) const override
The offset boundary is the one tracked surface with no envelope, in either role.
Definition TopoOffsetTriMesh.h:1288
bool collapse_edge_before(const Tuple &t) override
Reject any collapse that violates the substructure link condition.
Definition Optimize2d.cpp:715
std::shared_ptr< polysolve::nonlinear::Problem > rest_energy_for_vertex(size_t vid) const
Definition Optimize2d.cpp:471
std::shared_ptr< SampleEnvelope > m_offset_envelope
The tube the offset boundary may not leave during Phase A, of half-width offset_envelope....
Definition TopoOffsetTriMesh.h:459
bool tri_is_simp_emb(const Tuple &t) const
check if a triangle satisfies simpicial embedding criteria w.r.t. input complex (simplices labelled 1...
Definition TopoOffsetTriMesh.cpp:1058
std::vector< Tuple > offset_surface_edges_live_at(size_t vid) const
Definition Optimize2d.cpp:738
std::atomic< int > m_placement_projected
Definition TopoOffsetTriMesh.h:1083
bool swap_quality_allowed(const double after, const double before, const bool is_surface_flip) const override
Definition TopoOffsetTriMesh.h:2068
void init_offset_potential()
Build the smooth offset potential from the extraction init_input_complex_bvh() kept.
Definition TopoOffsetTriMesh.cpp:820
bool smooth_front_vertex_phase_b(const Tuple &t)
Phase B placement of a front vertex: the shared smoother with the offset's options.
Definition FrontSmooth2d.cpp:77
Definition Simplex.hpp:46
Definition enumerable_thread_specific.hpp:26
Definition TriOptimizerMesh.h:74
What the offset needs on top of the parameters every wmtk optimizer shares.
Definition Parameters.h:24
double front_conv_frac() const
Definition Parameters.h:81
bool deform_others
Definition Parameters.h:114
The band's distance error, split by whether the optimizer can do anything about it.
Definition TopoOffsetTriMesh.h:1607
size_t n_outside_support
Definition TopoOffsetTriMesh.h:1619
double max_at_vertex
Definition TopoOffsetTriMesh.h:1615
The residual sampled at points along a band edge – see offset_edge_samples().
Definition TopoOffsetTriMesh.h:1645
An edge's / face's shared attributes together with the offset's own label.
Definition TopoOffsetTriMesh.h:573
Definition TopoOffsetTriMesh.h:2330
Definition TopoOffsetTriMesh.h:1795
The "energy_gradient" criterion: the front is at a critical point of Phase B's energy,...
Definition TopoOffsetTriMesh.h:1755
size_t n_rings_at_floor
Definition TopoOffsetTriMesh.h:1824
double max_ring_at_floor
the worst of them, as a ratio to the bar
Definition TopoOffsetTriMesh.h:1825
double worst_edge_len
Definition TopoOffsetTriMesh.h:1761
bool ring_exit
front_measure "vertex_ring"
Definition TopoOffsetTriMesh.h:1813
std::vector< size_t > refinable_vertices
Definition TopoOffsetTriMesh.h:1821
size_t n_at_floor
Definition TopoOffsetTriMesh.h:1777
bool converged() const
Definition TopoOffsetTriMesh.h:1857
double worst_at_floor_scalar
Definition TopoOffsetTriMesh.h:1780
double max_edge
ratios to the bar (1 = bar)
Definition TopoOffsetTriMesh.h:1756
size_t n_edges_over
Definition TopoOffsetTriMesh.h:1767
bool vertices_ok() const
Definition TopoOffsetTriMesh.h:1832
double floor_scalar
The floor, max(min_sizing_scalar, min_edge_length / l), and which of the two it is.
Definition TopoOffsetTriMesh.h:1789
std::string sizing_floor_fact() const
Definition Optimize2d.cpp:2733
size_t n_rings_over
Definition TopoOffsetTriMesh.h:1818
double max_edge_corners_at_floor
the worst of them, as a ratio to the bar
Definition TopoOffsetTriMesh.h:1786
double max_ring
ratio to the bar (1 = bar)
Definition TopoOffsetTriMesh.h:1815
size_t n_unplaced
Definition TopoOffsetTriMesh.h:1791
double max_edge_at_floor
the worst of them, as a ratio to the bar
Definition TopoOffsetTriMesh.h:1778
size_t n_corners_at_floor
Definition TopoOffsetTriMesh.h:1785
Definition TopoOffsetTriMesh.h:578
Definition TopoOffsetTriMesh.h:2346
The convergence criterion's own split: ||grad (Phi - c)^2|| at band vertices – the deciding measure –...
Definition TopoOffsetTriMesh.h:1708
double max_in_edge_pinned
Definition TopoOffsetTriMesh.h:1719
size_t worst_vid
Definition TopoOffsetTriMesh.h:1729
double max_at_vertex
Definition TopoOffsetTriMesh.h:1716
size_t n_skipped_inverted
Definition TopoOffsetTriMesh.h:1726
size_t n_edge_samples
Edge-interior samples measured into max_in_edge (not part of n_reachable).
Definition TopoOffsetTriMesh.h:1723
double max_normal_aligned
max |2 (Phi - c) grad Phi . n| at band vertices, reachable AND pinned.
Definition TopoOffsetTriMesh.h:1721
Definition TopoOffsetTriMesh.h:734
double parent_flatness
Definition TopoOffsetTriMesh.h:749
double parent_q_max
Definition TopoOffsetTriMesh.h:746
uint64_t edge_bits
Definition TopoOffsetTriMesh.h:743
What smoothing did with each class of vertex, per pass.
Definition TopoOffsetTriMesh.h:898
std::atomic< int > offset_accepted
... and the smoother kept the new position
Definition TopoOffsetTriMesh.h:907
std::atomic< int > offset_attempted
reached the smoother with the offset term
Definition TopoOffsetTriMesh.h:906
std::atomic< int > interior_attempted
reached it without one
Definition TopoOffsetTriMesh.h:908
std::atomic< int > before_phase_b_not_offset
Phase B: on an input surface, neither placed nor relaxed.
Definition TopoOffsetTriMesh.h:902
std::atomic< int > attempted
smooth_before() entered
Definition TopoOffsetTriMesh.h:899
std::atomic< int > region_attempted
Definition TopoOffsetTriMesh.h:909
std::atomic< int > before_phase_b_enveloped_background
Phase B: envelope-held.
Definition TopoOffsetTriMesh.h:904
std::atomic< long long > res_before_nano
Definition TopoOffsetTriMesh.h:916
std::atomic< int > before_unrounded
base smooth_before said no: could not round
Definition TopoOffsetTriMesh.h:901
std::atomic< int > before_bbox
base smooth_before said no: on the bounding box
Definition TopoOffsetTriMesh.h:900
std::atomic< int > before_phase_b_enveloped_offset
Phase B: on-offset AND held.
Definition TopoOffsetTriMesh.h:905
Definition TopoOffsetTriMesh.h:1905
double front_max_step
Definition TopoOffsetTriMesh.h:1912
double background_max_step
Definition TopoOffsetTriMesh.h:1915
double front_max_ratio
Definition TopoOffsetTriMesh.h:1908
size_t n_front
front vertices the max was taken over
Definition TopoOffsetTriMesh.h:1910
size_t n_front_unmeasurable
ratio not finite: left out of the max
Definition TopoOffsetTriMesh.h:1911
The per-tag boundary polyline, with the adjacency an arclength walk needs.
Definition TopoOffsetTriMesh.h:282
std::vector< std::vector< int > > at_vertex
polyline vertex -> incident segment ids
Definition TopoOffsetTriMesh.h:284
std::vector< Eigen::Vector2i > E
segments, indexing m_env_polyline_V
Definition TopoOffsetTriMesh.h:283