Wildmeshing Toolkit
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
wmtk::components::tracking::CurveMap Class Reference

The map between the first and the last state of a CurveHistory. More...

#include <CurveMap.hpp>

Classes

struct  Chain
 A polyline: segments end to end, each run from its first corner to its second or back. More...
 
struct  Image
 
struct  Step
 

Public Member Functions

 CurveMap (const history::CurveHistory &h, const CurveMapOptions &options={})
 
std::vector< CurvePoint > to_input (std::vector< CurvePoint > points, CurveMapWarnings *warnings=nullptr) const
 
std::vector< CurvePoint > to_output (std::vector< CurvePoint > points, CurveMapWarnings *warnings=nullptr) const
 Points on the first state, mapped onto the last; see to_input.
 
const CurveMapWarnings & build_warnings () const
 What building the map found.
 
const std::vector< size_t > & warned_edits () const
 The edits (indices into the history) whose local map raised a build warning.
 
const std::vector< Eigen::Vector3d > & input_vertices () const
 The curves at the start and at the end, every slot, as the history holds them.
 
const std::vector< std::array< uint64_t, 2 > > & input_segments () const
 
const std::vector< uint8_t > & input_segment_alive () const
 
const std::vector< Eigen::Vector3d > & output_vertices () const
 
const std::vector< std::array< uint64_t, 2 > > & output_segments () const
 
const std::vector< uint8_t > & output_segment_alive () const
 
const std::vector< std::array< uint64_t, 2 > > & feature_points () const
 
const std::vector< uint64_t > & output_feature_points () const
 The feature points of the last state.
 
const std::array< size_t, 16 > & steps_by_kind () const
 How many operations needed a local map, by kind (index: history::EditKind).
 

Private Types

using Place = std::pair< uint32_t, uint32_t >
 Where a segment is on a step's chains: the pair, and its place on the chain.
 

Private Member Functions

void build_local (history::CurveReplay &r, const history::Edit &e, Step &step, bool flatten)
 
void build_renumbering (history::CurveReplay &r, const history::Edit &e, Step &step)
 
void build_embed (history::CurveReplay &r, const history::Edit &e, Step &step)
 
void build_replace (history::CurveReplay &r, const history::Edit &e, Step &step)
 
void map (std::vector< CurvePoint > &points, bool to_output, CurveMapWarnings &warnings) const
 

Static Private Member Functions

static void measure (Chain &c)
 
static bool forward (const Step &s, CurvePoint &p)
 One point through one step, or back; false if it has no image.
 
static bool backward (const Step &s, CurvePoint &p)
 
static CurvePoint along (const Chain &from, size_t i, const Eigen::Vector2d &bary, const Chain &to)
 The point at the same fraction of arc length along to as bary on segment i of from.
 

Private Attributes

std::vector< Step > m_steps
 
CurveMapWarnings m_build_warnings
 
std::vector< size_t > m_warned_edits
 
std::vector< Eigen::Vector3d > m_in_vertices
 
std::vector< Eigen::Vector3d > m_out_vertices
 
std::vector< std::array< uint64_t, 2 > > m_in_segments
 
std::vector< std::array< uint64_t, 2 > > m_out_segments
 
std::vector< uint8_t > m_in_alive
 
std::vector< uint8_t > m_out_alive
 
std::vector< std::array< uint64_t, 2 > > m_features
 
std::vector< uint64_t > m_out_features
 
std::array< size_t, 16 > m_steps_by_kind = {}
 

Detailed Description

The map between the first and the last state of a CurveHistory.

Built from the history alone, one local map per operation: BijectiveRemesh in one dimension, where a joint flattening is exact. An operation changes the segments around a few vertices; between the vertices it leaves in place – untouched ones, and junctions, ends and feature points, which split the curves into chains – the curve before and the curve after are two polylines between the same two vertices, and the local map takes one onto the other by normalised arc length: a bijection by construction, with constant stretch along the chain. A split, a collapse and a smoothing step are all mapped so. An operation that changes the topology leaves chains with no counterpart; their segments are mapped by relabelling where they still exist, and counted (CurveMapWarnings::topology). A chain a collapse contracted – two anchors collapsed into one, or a loop of three closed into a doubled segment – holds the collapsed segment, which no longer exists: it maps by arc length onto what the chain became, the segments it merged into or the survivor alone. A relabel and a consolidation renumber segments; an embed maps each point to the same place on the segment it lies on.

Member Function Documentation

◆ feature_points()

const std::vector< std::array< uint64_t, 2 > > & wmtk::components::tracking::CurveMap::feature_points ( ) const
inline

Each feature point of the first state (History::features) and the vertex of the last state it became – its vertex followed through collapses, relabels and embeds – or history::kNoVertex if it is gone.

◆ map()

void wmtk::components::tracking::CurveMap::map ( std::vector< CurvePoint > &  points,
bool  to_output,
CurveMapWarnings &  warnings 
) const
private

Points through every step, forward or back, counting those left without an image in warnings. A local step moves only the points on its own segments, which an index finds.

◆ measure()

void wmtk::components::tracking::CurveMap::measure ( Chain &  c)
staticprivate

Sets a chain's starts and total from its segments' lengths, each counting for at least a billionth of the chain's mean segment – or all alike, if the chain has no length. A segment of no length in doubles, two vertices the arrangement set apart by less than their rounding, then keeps a sliver of the chain, and the map stays one to one; any other chain is measured by its arc length exactly.

◆ to_input()

std::vector< CurvePoint > wmtk::components::tracking::CurveMap::to_input ( std::vector< CurvePoint >  points,
CurveMapWarnings *  warnings = nullptr 
) const

Points on the last state, mapped onto the first. warnings, if given, gets what this call found. The map is not changed: any number of threads may map through it at once.


The documentation for this class was generated from the following files: