FuncViz lib
Generalized bitree/quadtree/octree library
Loading...
Searching...
No Matches
mjr::MR_rt_to_cc< rt_t, cc_t > Class Template Reference

Tessellates a MR_rect_tree object, and places the result into an MR_cell_cplx object. More...

#include <MR_rt_to_cc.hpp>

Describe point source.

enum class  val_src_spc_t { FDOMAIN , FRANGE , CONSTANT }
 Specify a source space for a data index. More...
 
typedef std::variant< int, cc_uft_tiorf_t
 Type to hold an integer or float.
 
typedef std::tuple< val_src_spc_t, iorf_tval_src_t
 Type used to hold a description of how to extract a scalar value from a tree object.
 
typedef std::vector< val_src_tval_src_lst_t
 A list of val_src_t objects.
 

Types imported from MR_rect_tree and MR_cell_cplx.

typedef cc_t::node_data_idx_lst_t cc_node_data_idx_lst_t
 
typedef cc_t::node_data_t cc_node_data_t
 
typedef cc_t::node_idx_list_t cc_node_idx_list_t
 
typedef cc_t::node_idx_t cc_node_idx_t
 
typedef cc_t::cell_verts_t cc_cell_verts_t
 
typedef cc_t::uft_t cc_uft_t
 
typedef rt_t::diti_list_t rt_diti_list_t
 
typedef rt_t::diti_t rt_diti_t
 
typedef rt_t::drpt_t rt_drpt_t
 
typedef rt_t::drpt2real_func_t rt_drpt2real_func_t
 
typedef rt_t::rrpt_t rt_rrpt_t
 
typedef rt_t::drpt2rrpt_func_t rt_drpt2rrpt_func_t
 

Utility Functions.

static void create_dataset_to_point_mapping (const rt_t &rtree, cc_t &ccplx, const val_src_lst_t &rt_dil)
 Create approprate inputs for ccplx.create_dataset_to_point_mapping() from tree data.
 
static cc_node_idx_t add_node (cc_t &ccplx, const rt_t &rtree, rt_diti_t diti)
 Given rt coordinates, extract point/scalar/vector data, and add point/data to cc.
 
static cc_node_idx_t add_node (cc_t &ccplx, rt_drpt_t dom_pnt, rt_rrpt_t rng_pnt)
 Given rt coordinates, extract point/scalar/vector data, and add point/data to cc.
 
static cc_node_data_t rt_pnt_to_cc_pnt (rt_drpt_t dom_pnt, rt_rrpt_t rng_pnt)
 Given rt_t domain & range points, produce a cc_t point data vector.
 
static rt_drpt_t node_data_to_drpt (const cc_node_data_t &pd)
 Transform a MR_cell_cplx::node_data_t value into MR_rect_tree::drpt_t.
 
static int rt_rng_idx_to_pd_idx (int tree_range_index)
 Convert a MR_rect_tree range index into an index for a point data array.
 
static cc_node_idx_t nan_edge_solver (cc_t &ccplx, const rt_t &rtree, cc_node_idx_t good_point_ccplx_index, rt_diti_t good_point_rtree_index, rt_diti_t sick_point_rtree_index, rt_drpt2rrpt_func_t func, cc_uft_t solver_epsilon=cc_t::epsilon/100)
 Given an edge with one good point and one NaN point, find the longest segment from the good point toward the NaN point.
 

Poly data construction

static int construct_geometry_fans (cc_t &ccplx, const rt_t &rtree, rt_diti_list_t cells, int output_dimension, val_src_lst_t point_src, rt_drpt2rrpt_func_t func=nullptr)
 Populate attached MR_cell_cplx object from data in attached MR_rect_tree object.
 
static int construct_geometry_fans (cc_t &ccplx, const rt_t &rtree, int output_dimension, val_src_lst_t point_src, rt_drpt2rrpt_func_t func=nullptr)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static int construct_geometry_points (cc_t &ccplx, const rt_t &rtree, rt_diti_list_t cells, val_src_lst_t point_src, bool output_centers, bool output_corners)
 Populate attached MR_cell_cplx object from data in attached MR_rect_tree object.
 
static int construct_geometry_points (cc_t &ccplx, const rt_t &rtree, val_src_lst_t point_src, bool output_centers, bool output_corners)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
static int construct_geometry_rects (cc_t &ccplx, const rt_t &rtree, rt_diti_list_t cells, int output_dimension, val_src_lst_t point_src, bool degenerate_fallback=true)
 Populate a MR_cell_cplx object from data in a MR_rect_tree object.
 
static int construct_geometry_rects (cc_t &ccplx, const rt_t &rtree, int output_dimension, val_src_lst_t point_src, bool degenerate_fallback=true)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Function Adapters

static cc_node_data_t tsampf_to_cdatf (rt_drpt2rrpt_func_t func, cc_node_data_t pd)
 Adapt a MR_rect_tree::drpt2rrpt_func_t (sample function) to a MR_cell_cplx::p2data_func_t (Point Data Transform).
 
static cc_uft_t tsdf_to_csdf (rt_drpt2real_func_t func, cc_node_data_t pd)
 Adapt a MR_rect_tree::drpt2real_func_t (Domain Point SDF) to MR_cell_cplx::p2real_func_t (Point Data SDF).
 
static cc_uft_t tsampf_to_clcdf (int range_index, cc_uft_t level, rt_drpt2rrpt_func_t func, cc_node_data_t pd)
 Evalate an MR_cell_cplx::p2real_func_t (Point Data SDF) function from a MR_rect_tree::drpt2rrpt_func_t (Sample Function) and level data.
 

Mathematical Tools

static int cull_cc_cells_on_domain_sdf_boundry (cc_t &ccplx, rt_drpt2real_func_t sdf_func)
 Drop cells from a MR_cell_cplx object using an MR_rect_tree domain SDF function.
 

Detailed Description

template<class rt_t, class cc_t>
requires (std::is_same<typename rt_t::src_t, typename cc_t::uft_t>::value)
class mjr::MR_rt_to_cc< rt_t, cc_t >

Tessellates a MR_rect_tree object, and places the result into an MR_cell_cplx object.

From a structural perspective this class simply a templated collection of types and static methods all designed to work with pairs of MR_rect_tree and MR_cell_cplx objects. From a functional, or pattern, perspective this class might classified as a MR_cell_cplx pseudo-constructor or proto-factory. I think of it as a bridge between MR_rect_tree and MR_cell_cplx objects. A collection of helper types that ease working with pairs of MR_rect_tree and MR_cell_cplx objects containing data derived from the same sampled function.

Template Parameters
rt_tThe type of supported MR_rect_tree objects
cc_tThe type of supported MR_cell_cplx objects

Definition at line 58 of file MR_rt_to_cc.hpp.

Member Typedef Documentation

◆ cc_cell_verts_t

template<class rt_t , class cc_t >
typedef cc_t::cell_verts_t mjr::MR_rt_to_cc< rt_t, cc_t >::cc_cell_verts_t

Definition at line 70 of file MR_rt_to_cc.hpp.

◆ cc_node_data_idx_lst_t

template<class rt_t , class cc_t >
typedef cc_t::node_data_idx_lst_t mjr::MR_rt_to_cc< rt_t, cc_t >::cc_node_data_idx_lst_t

Definition at line 66 of file MR_rt_to_cc.hpp.

◆ cc_node_data_t

template<class rt_t , class cc_t >
typedef cc_t::node_data_t mjr::MR_rt_to_cc< rt_t, cc_t >::cc_node_data_t

Definition at line 67 of file MR_rt_to_cc.hpp.

◆ cc_node_idx_list_t

template<class rt_t , class cc_t >
typedef cc_t::node_idx_list_t mjr::MR_rt_to_cc< rt_t, cc_t >::cc_node_idx_list_t

Definition at line 68 of file MR_rt_to_cc.hpp.

◆ cc_node_idx_t

template<class rt_t , class cc_t >
typedef cc_t::node_idx_t mjr::MR_rt_to_cc< rt_t, cc_t >::cc_node_idx_t

Definition at line 69 of file MR_rt_to_cc.hpp.

◆ cc_uft_t

template<class rt_t , class cc_t >
typedef cc_t::uft_t mjr::MR_rt_to_cc< rt_t, cc_t >::cc_uft_t

Definition at line 71 of file MR_rt_to_cc.hpp.

◆ iorf_t

template<class rt_t , class cc_t >
typedef std::variant<int, cc_uft_t> mjr::MR_rt_to_cc< rt_t, cc_t >::iorf_t

Type to hold an integer or float.

Definition at line 91 of file MR_rt_to_cc.hpp.

◆ rt_diti_list_t

template<class rt_t , class cc_t >
typedef rt_t::diti_list_t mjr::MR_rt_to_cc< rt_t, cc_t >::rt_diti_list_t

Definition at line 72 of file MR_rt_to_cc.hpp.

◆ rt_diti_t

template<class rt_t , class cc_t >
typedef rt_t::diti_t mjr::MR_rt_to_cc< rt_t, cc_t >::rt_diti_t

Definition at line 73 of file MR_rt_to_cc.hpp.

◆ rt_drpt2real_func_t

template<class rt_t , class cc_t >
typedef rt_t::drpt2real_func_t mjr::MR_rt_to_cc< rt_t, cc_t >::rt_drpt2real_func_t

Definition at line 75 of file MR_rt_to_cc.hpp.

◆ rt_drpt2rrpt_func_t

template<class rt_t , class cc_t >
typedef rt_t::drpt2rrpt_func_t mjr::MR_rt_to_cc< rt_t, cc_t >::rt_drpt2rrpt_func_t

Definition at line 77 of file MR_rt_to_cc.hpp.

◆ rt_drpt_t

template<class rt_t , class cc_t >
typedef rt_t::drpt_t mjr::MR_rt_to_cc< rt_t, cc_t >::rt_drpt_t

Definition at line 74 of file MR_rt_to_cc.hpp.

◆ rt_rrpt_t

template<class rt_t , class cc_t >
typedef rt_t::rrpt_t mjr::MR_rt_to_cc< rt_t, cc_t >::rt_rrpt_t

Definition at line 76 of file MR_rt_to_cc.hpp.

◆ val_src_lst_t

template<class rt_t , class cc_t >
typedef std::vector<val_src_t> mjr::MR_rt_to_cc< rt_t, cc_t >::val_src_lst_t

A list of val_src_t objects.


Definition at line 97 of file MR_rt_to_cc.hpp.

◆ val_src_t

template<class rt_t , class cc_t >
typedef std::tuple<val_src_spc_t, iorf_t> mjr::MR_rt_to_cc< rt_t, cc_t >::val_src_t

Type used to hold a description of how to extract a scalar value from a tree object.

Definition at line 94 of file MR_rt_to_cc.hpp.

Member Enumeration Documentation

◆ val_src_spc_t

template<class rt_t , class cc_t >
enum class mjr::MR_rt_to_cc::val_src_spc_t
strong

Specify a source space for a data index.

Enumerator
FDOMAIN 

Sample function domain space.

FRANGE 

Sample function range space.

CONSTANT 

A pseudo-source that returns a constant.

Definition at line 85 of file MR_rt_to_cc.hpp.

Member Function Documentation

◆ add_node() [1/2]

template<class rt_t , class cc_t >
static cc_node_idx_t mjr::MR_rt_to_cc< rt_t, cc_t >::add_node ( cc_t & ccplx,
const rt_t & rtree,
rt_diti_t diti )
inlinestaticprivate

Given rt coordinates, extract point/scalar/vector data, and add point/data to cc.

Parameters
ccplxThe MR_cell_cplx to populate with geometry
rtreeThe MR_rect_tree with source data
ditiThe point coordinate in rtree

Definition at line 125 of file MR_rt_to_cc.hpp.

◆ add_node() [2/2]

template<class rt_t , class cc_t >
static cc_node_idx_t mjr::MR_rt_to_cc< rt_t, cc_t >::add_node ( cc_t & ccplx,
rt_drpt_t dom_pnt,
rt_rrpt_t rng_pnt )
inlinestaticprivate

Given rt coordinates, extract point/scalar/vector data, and add point/data to cc.

Parameters
ccplxThe MR_cell_cplx to populate with geometry
dom_pntDomain point
rng_pntRange point

Definition at line 133 of file MR_rt_to_cc.hpp.

◆ construct_geometry_fans() [1/2]

template<class rt_t , class cc_t >
static int mjr::MR_rt_to_cc< rt_t, cc_t >::construct_geometry_fans ( cc_t & ccplx,
const rt_t & rtree,
int output_dimension,
val_src_lst_t point_src,
rt_drpt2rrpt_func_t func = nullptr )
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 421 of file MR_rt_to_cc.hpp.

◆ construct_geometry_fans() [2/2]

template<class rt_t , class cc_t >
static int mjr::MR_rt_to_cc< rt_t, cc_t >::construct_geometry_fans ( cc_t & ccplx,
const rt_t & rtree,
rt_diti_list_t cells,
int output_dimension,
val_src_lst_t point_src,
rt_drpt2rrpt_func_t func = nullptr )
inlinestatic

Populate attached MR_cell_cplx object from data in attached MR_rect_tree object.

construct_geometry_fans(), unlike the other geometry construction methods, is capable of "healing" some broken edges – edges with one good point and one NaN point. It uses the origional sampling function to solve along the edge to produce the longest non-NaN edge possible. Then it constructs cells using the new piont(s). If func is nullptr, then no edge healing is preformed. This feature works for segments & triangles only.

| Geom       | Dom Dim | Out Dim | Result             |
|------------+---------+---------+--------------------|
| FANS       |       2 |       1 | Triangle Edges     |
| FANS       |       2 |       2 | Triangles          |
| FANS       |       3 |       1 | Pyramid Edges      |
| FANS       |       3 |       2 | Pyramid Faces      |
| FANS       |       3 |       3 | Solid Pyramids     |
Parameters
ccplxThe MR_cell_cplx to populate with geometry
rtreeThe MR_rect_tree with source data
cellsList of cells to output from rtree
output_dimensionParts of cells to output
point_srcPoint sources
funcThe function was used to sample the tree

Definition at line 265 of file MR_rt_to_cc.hpp.

◆ construct_geometry_points() [1/2]

template<class rt_t , class cc_t >
static int mjr::MR_rt_to_cc< rt_t, cc_t >::construct_geometry_points ( cc_t & ccplx,
const rt_t & rtree,
rt_diti_list_t cells,
val_src_lst_t point_src,
bool output_centers,
bool output_corners )
inlinestatic

Populate attached MR_cell_cplx object from data in attached MR_rect_tree object.

Only 0D vertex cells are produced. While similar results may be obtained by setting the output_dimension to zero and calling construct_geometry_fan() or construct_geometry_rects(), this method is much faster. This method also provides the option of only outputting centers without corners.

| Geom   | output_centers | output_corners | Result        | output_dimension=0 equivalent |
|--------+----------------+----------------+---------------+-------------------------------|
| POINTS | true           | true           | cell vertexes | construct_geometry_fans       |
| POINTS | true           | false          | cell centers  |                               |
| POINTS | false          | true           | cell corners  | construct_geometry_rects      |
| POINTS | false          | false          | No Points     |                               |
Parameters
ccplxThe MR_cell_cplx to populate with geometry
rtreeThe MR_rect_tree with source data
cellsList of tree cells from which to construct geometry
point_srcPoint sources
output_centersCreate vertexes for cell centers
output_cornersCreate vertexes for cell corners

Definition at line 451 of file MR_rt_to_cc.hpp.

◆ construct_geometry_points() [2/2]

template<class rt_t , class cc_t >
static int mjr::MR_rt_to_cc< rt_t, cc_t >::construct_geometry_points ( cc_t & ccplx,
const rt_t & rtree,
val_src_lst_t point_src,
bool output_centers,
bool output_corners )
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 478 of file MR_rt_to_cc.hpp.

◆ construct_geometry_rects() [1/2]

template<class rt_t , class cc_t >
static int mjr::MR_rt_to_cc< rt_t, cc_t >::construct_geometry_rects ( cc_t & ccplx,
const rt_t & rtree,
int output_dimension,
val_src_lst_t point_src,
bool degenerate_fallback = true )
inlinestatic

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 546 of file MR_rt_to_cc.hpp.

◆ construct_geometry_rects() [2/2]

template<class rt_t , class cc_t >
static int mjr::MR_rt_to_cc< rt_t, cc_t >::construct_geometry_rects ( cc_t & ccplx,
const rt_t & rtree,
rt_diti_list_t cells,
int output_dimension,
val_src_lst_t point_src,
bool degenerate_fallback = true )
inlinestatic

Populate a MR_cell_cplx object from data in a MR_rect_tree object.

The resulting geometric structure in the MR_cell_cplx object will consist of 'rectangular' cell types (points, segments, rectangles, & hexahedra).

| Geom       | Dom Dim | Out Dim | Result             |
|------------+---------+---------+--------------------|
| RECTANGLES |     1-3 |       0 | Cell Corner Points |
| RECTANGLES |     2-3 |       1 | Cell Edges         |
| RECTANGLES |       2 |       2 | 2D Rectangles      |
| RECTANGLES |       3 |       2 | Cell Faces         |
| RECTANGLES |       3 |       3 | Solid Hexahedra    |
Parameters
ccplxThe MR_cell_cplx to populate with geometry
rtreeThe MR_rect_tree with source data
cellsList of tree cells from which to construct geometry
output_dimensionParts of cells to output
point_srcPoint sources
degenerate_fallbackIf the rectangle is degenerate, try and make a triangle. (only works for cc_t::cell_kind_t::QUAD)

Definition at line 507 of file MR_rt_to_cc.hpp.

◆ create_dataset_to_point_mapping()

template<class rt_t , class cc_t >
static void mjr::MR_rt_to_cc< rt_t, cc_t >::create_dataset_to_point_mapping ( const rt_t & rtree,
cc_t & ccplx,
const val_src_lst_t & rt_dil )
inlinestaticprivate

Create approprate inputs for ccplx.create_dataset_to_point_mapping() from tree data.


Parameters
rtreeThe MR_rect_tree with source data
ccplxThe MR_cell_cplx to populate wiht a pont mapping
rt_dilDescription of data sources

Definition at line 109 of file MR_rt_to_cc.hpp.

◆ cull_cc_cells_on_domain_sdf_boundry()

template<class rt_t , class cc_t >
static int mjr::MR_rt_to_cc< rt_t, cc_t >::cull_cc_cells_on_domain_sdf_boundry ( cc_t & ccplx,
rt_drpt2real_func_t sdf_func )
inlinestatic

Drop cells from a MR_cell_cplx object using an MR_rect_tree domain SDF function.

Definition at line 601 of file MR_rt_to_cc.hpp.

◆ nan_edge_solver()

template<class rt_t , class cc_t >
static cc_node_idx_t mjr::MR_rt_to_cc< rt_t, cc_t >::nan_edge_solver ( cc_t & ccplx,
const rt_t & rtree,
cc_node_idx_t good_point_ccplx_index,
rt_diti_t good_point_rtree_index,
rt_diti_t sick_point_rtree_index,
rt_drpt2rrpt_func_t func,
cc_uft_t solver_epsilon = cc_t::epsilon/100 )
inlinestatic

Given an edge with one good point and one NaN point, find the longest segment from the good point toward the NaN point.

Note we normally use this function when we detect a NaN in a geometric point (i.e. the things with a node_idx_t). This solver solves until the return of func has no NaNs. Those two criteria might not be the same thing, but it's OK.

Parameters
ccplxThe MR_cell_cplx to populate with geometry
rtreeThe MR_rect_tree with source data
good_point_ccplx_indexGood point index in the ccplx object
good_point_rtree_indexGood point index in the rtree object
sick_point_rtree_indexBad point index in the rtree object
funcThe function to use for the solver
solver_epsilonUsed as a distance threshold between sick point and solved endpoint in the tree domain space.

Definition at line 194 of file MR_rt_to_cc.hpp.

◆ node_data_to_drpt()

template<class rt_t , class cc_t >
static rt_drpt_t mjr::MR_rt_to_cc< rt_t, cc_t >::node_data_to_drpt ( const cc_node_data_t & pd)
inlinestaticprivate

Transform a MR_cell_cplx::node_data_t value into MR_rect_tree::drpt_t.


Parameters
pdThe point data to convert.

Definition at line 157 of file MR_rt_to_cc.hpp.

◆ rt_pnt_to_cc_pnt()

template<class rt_t , class cc_t >
static cc_node_data_t mjr::MR_rt_to_cc< rt_t, cc_t >::rt_pnt_to_cc_pnt ( rt_drpt_t dom_pnt,
rt_rrpt_t rng_pnt )
inlinestaticprivate

Given rt_t domain & range points, produce a cc_t point data vector.

Parameters
dom_pntDomain point
rng_pntRange point

Definition at line 140 of file MR_rt_to_cc.hpp.

◆ rt_rng_idx_to_pd_idx()

template<class rt_t , class cc_t >
static int mjr::MR_rt_to_cc< rt_t, cc_t >::rt_rng_idx_to_pd_idx ( int tree_range_index)
inlinestatic

Convert a MR_rect_tree range index into an index for a point data array.

Parameters
tree_range_indexvalue to convert

Definition at line 178 of file MR_rt_to_cc.hpp.

◆ tsampf_to_cdatf()

template<class rt_t , class cc_t >
static cc_node_data_t mjr::MR_rt_to_cc< rt_t, cc_t >::tsampf_to_cdatf ( rt_drpt2rrpt_func_t func,
cc_node_data_t pd )
inlinestatic

Adapt a MR_rect_tree::drpt2rrpt_func_t (sample function) to a MR_cell_cplx::p2data_func_t (Point Data Transform).

Parameters
funcThe function to adapt
pdPoint data to be passed to func.

Definition at line 564 of file MR_rt_to_cc.hpp.

◆ tsampf_to_clcdf()

template<class rt_t , class cc_t >
static cc_uft_t mjr::MR_rt_to_cc< rt_t, cc_t >::tsampf_to_clcdf ( int range_index,
cc_uft_t level,
rt_drpt2rrpt_func_t func,
cc_node_data_t pd )
inlinestatic

Evalate an MR_cell_cplx::p2real_func_t (Point Data SDF) function from a MR_rect_tree::drpt2rrpt_func_t (Sample Function) and level data.

Parameters
range_indexIndex into range of origional sample function
levelLevel to check range element aginst
funcThe function to adapt
pdPoint data to be passed to func.

Definition at line 583 of file MR_rt_to_cc.hpp.

◆ tsdf_to_csdf()

template<class rt_t , class cc_t >
static cc_uft_t mjr::MR_rt_to_cc< rt_t, cc_t >::tsdf_to_csdf ( rt_drpt2real_func_t func,
cc_node_data_t pd )
inlinestatic

Adapt a MR_rect_tree::drpt2real_func_t (Domain Point SDF) to MR_cell_cplx::p2real_func_t (Point Data SDF).

Parameters
funcThe function to adapt
pdPoint data to be passed to func.

Definition at line 573 of file MR_rt_to_cc.hpp.


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