MEPP2 Project
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap > Class Template Reference

Batch_collapser: Takes an halfedge graph and collapses its edges. A Batch_collapser object can simplify as many times a mesh as possible. No need to create an object for each batch. Input: Original mesh. Output: a simplified mesh. More...

#include <Batch_collapser.h>

Collaboration diagram for FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >:
Collaboration graph

Public Types

using vertex_descriptor = typename boost::graph_traits< HalfedgeGraph >::vertex_descriptor
 
using halfedge_descriptor = typename boost::graph_traits< HalfedgeGraph >::halfedge_descriptor
 
using edge_descriptor = typename boost::graph_traits< HalfedgeGraph >::edge_descriptor
 
using face_descriptor = typename boost::graph_traits< HalfedgeGraph >::face_descriptor
 
using Vector = typename FEVV::Geometry_traits< HalfedgeGraph >::Vector
 
using Point = typename FEVV::Geometry_traits< HalfedgeGraph >::Point
 
using Geometry = typename FEVV::Geometry_traits< HalfedgeGraph >
 

Public Member Functions

 Batch_collapser (HalfedgeGraph &g, PointMap &pm, Metric *metric, Predictor< HalfedgeGraph, PointMap > *predictor, VertexColorMap &vcm, EdgeColorMap &ecm, BATCH_CONDITION batch_stop)
 Batch_collapser. More...
 
 ~Batch_collapser ()
 
bool stop ()
 stop() : Depending on the chosen Batch condition, will return whether we have to continue collapsing or not. More...
 
void save_spanning_tree (const FEVV::Comparator::Spanning_tree_vertex_edge_comparator< HalfedgeGraph, PointMap > &spanningtree)
 
void compute_distortion_l2 (FEVV::Filters::Geometric_metrics< HalfedgeGraph, PointMap > &g_metric, Header_handler &header, double diag, bool skip)
 Computes the L2 distorsion between the original mesh and the current LoD. More...
 
void collapse_batch ()
 
const std::vector< Refinement_info< HalfedgeGraph, PointMap > > & get_refinements () const
 
const std::vector< double > & get_RMSE_distortion () const
 
const std::vector< double > & get_hausdorff_distortion () const
 

Private Member Functions

void sort_list_memory (const FEVV::Comparator::Spanning_tree_vertex_edge_comparator< HalfedgeGraph, PointMap > &spanningtree)
 
void setup_prediction (FEVV::Comparator::Spanning_tree_vertex_edge_comparator< HalfedgeGraph, PointMap >)
 
bool are_halfedge_vertex_positions_change_without_normal_flip (halfedge_descriptor h_collapse, const Point &pos_vkept)
 Returns whether the edge collapse causes a normal flip. More...
 
bool is_vertex_position_change_without_normal_flip (halfedge_descriptor h_collapse, vertex_descriptor vertex, const Point &pos_vkept)
 
bool is_forbidden (halfedge_descriptor h, Point)
 
bool collapse_top_queue ()
 collapse_top_queue collapses the edge with the lowest cost, and records the necessary information in a Collapse_info object.
More...
 

Private Attributes

HalfedgeGraph & _g
 
PointMap & _pm
 the mesh being simplified More...
 
Metric * _metric
 
VertexColorMap & _vcm
 Measuring collapse cost of each edge. More...
 
EdgeColorMap & _ecm
 
std::set< halfedge_descriptor_forbidden_edges
 
const Geometry _gt
 Edges that cannot be collapsed in the current batch. More...
 
int _batch_id
 
int _nb_collapse
 current batch number More...
 
std::list< Collapse_info< HalfedgeGraph, PointMap > > _list_memory
 
FEVV::Filters::Predictor< HalfedgeGraph, PointMap > * _predictor
 
std::vector< Refinement_info< HalfedgeGraph, PointMap > > _refinements
 
std::vector< double > _RMSE_distortion_per_batch
 
std::vector< double > _hausdorff_distortion_per_batch
 
std::vector< std::vector< bool > > _list_edge_bitmask
 
int _link_condition
 
int _forbidden
 
int64_t _number_vertices_original
 
int64_t _number_vertices_last
 
BATCH_CONDITION _batch_stop
 

Detailed Description

template<typename HalfedgeGraph, typename PointMap, typename Metric, typename EdgeColorMap, typename VertexColorMap>
class FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >

Batch_collapser: Takes an halfedge graph and collapses its edges. A Batch_collapser object can simplify as many times a mesh as possible. No need to create an object for each batch. Input: Original mesh. Output: a simplified mesh.

Definition at line 65 of file Batch_collapser.h.

Member Typedef Documentation

◆ edge_descriptor

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
using FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::edge_descriptor = typename boost::graph_traits< HalfedgeGraph >::edge_descriptor

Definition at line 72 of file Batch_collapser.h.

◆ face_descriptor

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
using FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::face_descriptor = typename boost::graph_traits< HalfedgeGraph >::face_descriptor

Definition at line 74 of file Batch_collapser.h.

◆ Geometry

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
using FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::Geometry = typename FEVV::Geometry_traits< HalfedgeGraph >

Definition at line 78 of file Batch_collapser.h.

◆ halfedge_descriptor

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
using FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::halfedge_descriptor = typename boost::graph_traits< HalfedgeGraph >::halfedge_descriptor

Definition at line 70 of file Batch_collapser.h.

◆ Point

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
using FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::Point = typename FEVV::Geometry_traits< HalfedgeGraph >::Point

Definition at line 77 of file Batch_collapser.h.

◆ Vector

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
using FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::Vector = typename FEVV::Geometry_traits< HalfedgeGraph >::Vector

Definition at line 76 of file Batch_collapser.h.

◆ vertex_descriptor

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
using FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::vertex_descriptor = typename boost::graph_traits< HalfedgeGraph >::vertex_descriptor

Definition at line 68 of file Batch_collapser.h.

Constructor & Destructor Documentation

◆ Batch_collapser()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::Batch_collapser ( HalfedgeGraph &  g,
PointMap &  pm,
Metric *  metric,
Predictor< HalfedgeGraph, PointMap > *  predictor,
VertexColorMap &  vcm,
EdgeColorMap &  ecm,
BATCH_CONDITION  batch_stop 
)
inline

Batch_collapser.

Parameters
[in,out]gthe mesh to simplify
[in,out]pmthe point map associated to the mesh to simplify
[in]metricthe address (pointer) of an object used to measure the cost of each edge
[in]predictorthe address (pointer) of an object used to compute the geometric residuals
[in,out]vcma property map containing the color of each vertex (useful for debugging)
[in,out]ecma property map containing the color of each edge (useful for debugging)
[in]batch_stopan Enum to know when to stop a batch (collapses every edge we can or stop at a mean cost threshold)
Parameters
pmthe mesh to simplify
metricthe point map associated to the mesh to simplify
ecmfor debugging
batch_stopfor debugging

Definition at line 95 of file Batch_collapser.h.

Here is the call graph for this function:

◆ ~Batch_collapser()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::~Batch_collapser ( )
inline

Definition at line 116 of file Batch_collapser.h.

Member Function Documentation

◆ are_halfedge_vertex_positions_change_without_normal_flip()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
bool FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::are_halfedge_vertex_positions_change_without_normal_flip ( halfedge_descriptor  h_collapse,
const Point pos_vkept 
)
inlineprivate

Returns whether the edge collapse causes a normal flip.

Definition at line 312 of file Batch_collapser.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ collapse_batch()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
void FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::collapse_batch ( )
inline

Collapses all the collapsible edges from the mesh in Batch_collapser::_g 1) compute all edge costs for current batch; 2) greedy collapse of the collapsible edges with lowest cost while the batch stopping condition is not met.

Definition at line 236 of file Batch_collapser.h.

Here is the call graph for this function:

◆ collapse_top_queue()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
bool FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::collapse_top_queue ( )
inlineprivate

collapse_top_queue collapses the edge with the lowest cost, and records the necessary information in a Collapse_info object.

Add source and target vertex positions

Add pivot vertices

Definition at line 419 of file Batch_collapser.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compute_distortion_l2()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
void FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::compute_distortion_l2 ( FEVV::Filters::Geometric_metrics< HalfedgeGraph, PointMap > &  g_metric,
Header_handler header,
double  diag,
bool  skip 
)
inline

Computes the L2 distorsion between the original mesh and the current LoD.

Parameters
headerobject containing the original mesh
diagheader containing every compression info (used to dequantize the mesh)
skipdiagonal of the mesh bounding box (to normalize) we can choose to skip distorsion computation (the value will be -1). For example, we can choose to only compute L2 distorsion on 1 LOD out of 5 to save time

Definition at line 172 of file Batch_collapser.h.

Here is the call graph for this function:

◆ get_hausdorff_distortion()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
const std::vector< double >& FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::get_hausdorff_distortion ( ) const
inline

Definition at line 506 of file Batch_collapser.h.

◆ get_refinements()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
const std::vector< Refinement_info< HalfedgeGraph, PointMap > >& FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::get_refinements ( ) const
inline

Definition at line 499 of file Batch_collapser.h.

◆ get_RMSE_distortion()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
const std::vector< double >& FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::get_RMSE_distortion ( ) const
inline

Definition at line 505 of file Batch_collapser.h.

◆ is_forbidden()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
bool FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::is_forbidden ( halfedge_descriptor  h,
Point   
)
inlineprivate

Definition at line 405 of file Batch_collapser.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_vertex_position_change_without_normal_flip()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
bool FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::is_vertex_position_change_without_normal_flip ( halfedge_descriptor  h_collapse,
vertex_descriptor  vertex,
const Point pos_vkept 
)
inlineprivate

Returns whether the change of position for the vertex vertex with pos_vkept will create an incident face normal flip.

Returns
True if everything is all right, else false.

Definition at line 322 of file Batch_collapser.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_spanning_tree()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
void FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::save_spanning_tree ( const FEVV::Comparator::Spanning_tree_vertex_edge_comparator< HalfedgeGraph, PointMap > &  spanningtree)
inline

Write mesh vertices in a text file (and the number of incident faces) in the order of the spanning tree (useful for comparing spanning trees between compression and decompression).

Definition at line 149 of file Batch_collapser.h.

Here is the call graph for this function:

◆ setup_prediction()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
void FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::setup_prediction ( FEVV::Comparator::Spanning_tree_vertex_edge_comparator< HalfedgeGraph, PointMap >  )
inlineprivate

Definition at line 216 of file Batch_collapser.h.

Here is the caller graph for this function:

◆ sort_list_memory()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
void FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::sort_list_memory ( const FEVV::Comparator::Spanning_tree_vertex_edge_comparator< HalfedgeGraph, PointMap > &  spanningtree)
inlineprivate

Definition at line 207 of file Batch_collapser.h.

Here is the caller graph for this function:

◆ stop()

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
bool FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::stop ( )
inline

stop() : Depending on the chosen Batch condition, will return whether we have to continue collapsing or not.

Definition at line 120 of file Batch_collapser.h.

Here is the caller graph for this function:

Member Data Documentation

◆ _batch_id

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
int FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_batch_id
private

Definition at line 515 of file Batch_collapser.h.

◆ _batch_stop

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
BATCH_CONDITION FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_batch_stop
private

Definition at line 533 of file Batch_collapser.h.

◆ _ecm

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
EdgeColorMap& FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_ecm
private

Definition at line 512 of file Batch_collapser.h.

◆ _forbidden

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
int FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_forbidden
private

Definition at line 531 of file Batch_collapser.h.

◆ _forbidden_edges

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
std::set< halfedge_descriptor > FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_forbidden_edges
private

Definition at line 513 of file Batch_collapser.h.

◆ _g

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
HalfedgeGraph& FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_g
private

Definition at line 508 of file Batch_collapser.h.

◆ _gt

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
const Geometry FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_gt
private

Edges that cannot be collapsed in the current batch.

Definition at line 514 of file Batch_collapser.h.

◆ _hausdorff_distortion_per_batch

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
std::vector< double > FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_hausdorff_distortion_per_batch
private

Definition at line 528 of file Batch_collapser.h.

◆ _link_condition

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
int FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_link_condition
private

Definition at line 530 of file Batch_collapser.h.

◆ _list_edge_bitmask

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
std::vector< std::vector< bool > > FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_list_edge_bitmask
private

Definition at line 529 of file Batch_collapser.h.

◆ _list_memory

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
std::list< Collapse_info< HalfedgeGraph, PointMap > > FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_list_memory
private

Definition at line 517 of file Batch_collapser.h.

◆ _metric

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
Metric* FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_metric
private

Definition at line 510 of file Batch_collapser.h.

◆ _nb_collapse

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
int FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_nb_collapse
private

current batch number

Definition at line 516 of file Batch_collapser.h.

◆ _number_vertices_last

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
int64_t FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_number_vertices_last
private

Definition at line 532 of file Batch_collapser.h.

◆ _number_vertices_original

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
int64_t FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_number_vertices_original
private

Definition at line 532 of file Batch_collapser.h.

◆ _pm

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
PointMap& FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_pm
private

the mesh being simplified

Definition at line 509 of file Batch_collapser.h.

◆ _predictor

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
FEVV::Filters:: Predictor< HalfedgeGraph, PointMap >* FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_predictor
private

Current batch' collapse information to sort in the spanning tree vertex traversal order.

Definition at line 521 of file Batch_collapser.h.

◆ _refinements

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
std::vector< Refinement_info< HalfedgeGraph, PointMap > > FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_refinements
private

Definition at line 524 of file Batch_collapser.h.

◆ _RMSE_distortion_per_batch

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
std::vector< double > FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_RMSE_distortion_per_batch
private

One refinement object per simplification batch. These objects are stored in the batch simplification order, i.e. LoD_i is stored at the #LoD - i - 1 position.

Definition at line 528 of file Batch_collapser.h.

◆ _vcm

template<typename HalfedgeGraph , typename PointMap , typename Metric , typename EdgeColorMap , typename VertexColorMap >
VertexColorMap& FEVV::Filters::Batch_collapser< HalfedgeGraph, PointMap, Metric, EdgeColorMap, VertexColorMap >::_vcm
private

Measuring collapse cost of each edge.

Definition at line 511 of file Batch_collapser.h.


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