|
@@ -13,6 +13,67 @@
|
|
|
#include <set>
|
|
#include <set>
|
|
|
namespace igl
|
|
namespace igl
|
|
|
{
|
|
{
|
|
|
|
|
+ // Function handles used to customize the `igl::decimate` command.
|
|
|
|
|
+ using decimate_cost_and_placement_func =
|
|
|
|
|
+ std::function<void(
|
|
|
|
|
+ const int /*e*/,
|
|
|
|
|
+ const Eigen::MatrixXd &/*V*/,
|
|
|
|
|
+ const Eigen::MatrixXi &/*F*/,
|
|
|
|
|
+ const Eigen::MatrixXi &/*E*/,
|
|
|
|
|
+ const Eigen::VectorXi &/*EMAP*/,
|
|
|
|
|
+ const Eigen::MatrixXi &/*EF*/,
|
|
|
|
|
+ const Eigen::MatrixXi &/*EI*/,
|
|
|
|
|
+ double & /*cost*/,
|
|
|
|
|
+ Eigen::RowVectorXd & /*p*/
|
|
|
|
|
+ )>;
|
|
|
|
|
+ using decimate_stopping_condition_func =
|
|
|
|
|
+ std::function<bool(
|
|
|
|
|
+ const Eigen::MatrixXd & ,/*V*/
|
|
|
|
|
+ const Eigen::MatrixXi & ,/*F*/
|
|
|
|
|
+ const Eigen::MatrixXi & ,/*E*/
|
|
|
|
|
+ const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
+ const Eigen::MatrixXi & ,/*EF*/
|
|
|
|
|
+ const Eigen::MatrixXi & ,/*EI*/
|
|
|
|
|
+ const std::set<std::pair<double,int> > & ,/*Q*/
|
|
|
|
|
+ const std::vector<std::set<std::pair<double,int> >::iterator > &,/*Qit*/
|
|
|
|
|
+ const Eigen::MatrixXd & ,/*C*/
|
|
|
|
|
+ const int ,/*e*/
|
|
|
|
|
+ const int ,/*e1*/
|
|
|
|
|
+ const int ,/*e2*/
|
|
|
|
|
+ const int ,/*f1*/
|
|
|
|
|
+ const int /*f2*/
|
|
|
|
|
+ )>;
|
|
|
|
|
+ using decimate_pre_collapse_func =
|
|
|
|
|
+ std::function<bool(
|
|
|
|
|
+ const Eigen::MatrixXd & ,/*V*/
|
|
|
|
|
+ const Eigen::MatrixXi & ,/*F*/
|
|
|
|
|
+ const Eigen::MatrixXi & ,/*E*/
|
|
|
|
|
+ const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
+ const Eigen::MatrixXi & ,/*EF*/
|
|
|
|
|
+ const Eigen::MatrixXi & ,/*EI*/
|
|
|
|
|
+ const std::set<std::pair<double,int> > & ,/*Q*/
|
|
|
|
|
+ const std::vector<std::set<std::pair<double,int> >::iterator > &,/*Qit*/
|
|
|
|
|
+ const Eigen::MatrixXd & ,/*C*/
|
|
|
|
|
+ const int /*e*/
|
|
|
|
|
+ )>;
|
|
|
|
|
+ using decimate_post_collapse_func =
|
|
|
|
|
+ std::function<void(
|
|
|
|
|
+ const Eigen::MatrixXd & , /*V*/
|
|
|
|
|
+ const Eigen::MatrixXi & , /*F*/
|
|
|
|
|
+ const Eigen::MatrixXi & , /*E*/
|
|
|
|
|
+ const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
+ const Eigen::MatrixXi & , /*EF*/
|
|
|
|
|
+ const Eigen::MatrixXi & , /*EI*/
|
|
|
|
|
+ const std::set<std::pair<double,int> > & , /*Q*/
|
|
|
|
|
+ const std::vector<std::set<std::pair<double,int> >::iterator > &, /*Qit*/
|
|
|
|
|
+ const Eigen::MatrixXd & , /*C*/
|
|
|
|
|
+ const int , /*e*/
|
|
|
|
|
+ const int , /*e1*/
|
|
|
|
|
+ const int , /*e2*/
|
|
|
|
|
+ const int , /*f1*/
|
|
|
|
|
+ const int , /*f2*/
|
|
|
|
|
+ const bool /*collapsed*/
|
|
|
|
|
+ )>;
|
|
|
// Assumes (V,F) is a manifold mesh (possibly with boundary) Collapses edges
|
|
// Assumes (V,F) is a manifold mesh (possibly with boundary) Collapses edges
|
|
|
// until desired number of faces is achieved. This uses default edge cost and
|
|
// until desired number of faces is achieved. This uses default edge cost and
|
|
|
// merged vertex placement functions {edge length, edge midpoint}.
|
|
// merged vertex placement functions {edge length, edge midpoint}.
|
|
@@ -68,33 +129,8 @@ namespace igl
|
|
|
IGL_INLINE bool decimate(
|
|
IGL_INLINE bool decimate(
|
|
|
const Eigen::MatrixXd & V,
|
|
const Eigen::MatrixXd & V,
|
|
|
const Eigen::MatrixXi & F,
|
|
const Eigen::MatrixXi & F,
|
|
|
- const std::function<void(
|
|
|
|
|
- const int /*e*/,
|
|
|
|
|
- const Eigen::MatrixXd &/*V*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*F*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*E*/,
|
|
|
|
|
- const Eigen::VectorXi &/*EMAP*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*EF*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*EI*/,
|
|
|
|
|
- double & /*cost*/,
|
|
|
|
|
- Eigen::RowVectorXd & /*p*/
|
|
|
|
|
- )> & cost_and_placement,
|
|
|
|
|
- const std::function<bool(
|
|
|
|
|
- const Eigen::MatrixXd & ,/*V*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*F*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*E*/
|
|
|
|
|
- const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EF*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EI*/
|
|
|
|
|
- const std::set<std::pair<double,int> > & ,/*Q*/
|
|
|
|
|
- const std::vector<std::set<std::pair<double,int> >::iterator > &,/*Qit*/
|
|
|
|
|
- const Eigen::MatrixXd & ,/*C*/
|
|
|
|
|
- const int ,/*e*/
|
|
|
|
|
- const int ,/*e1*/
|
|
|
|
|
- const int ,/*e2*/
|
|
|
|
|
- const int ,/*f1*/
|
|
|
|
|
- const int /*f2*/
|
|
|
|
|
- )> & stopping_condition,
|
|
|
|
|
|
|
+ const decimate_cost_and_placement_func & cost_and_placement,
|
|
|
|
|
+ const decimate_stopping_condition_func & stopping_condition,
|
|
|
Eigen::MatrixXd & U,
|
|
Eigen::MatrixXd & U,
|
|
|
Eigen::MatrixXi & G,
|
|
Eigen::MatrixXi & G,
|
|
|
Eigen::VectorXi & J,
|
|
Eigen::VectorXi & J,
|
|
@@ -109,62 +145,10 @@ namespace igl
|
|
|
IGL_INLINE bool decimate(
|
|
IGL_INLINE bool decimate(
|
|
|
const Eigen::MatrixXd & V,
|
|
const Eigen::MatrixXd & V,
|
|
|
const Eigen::MatrixXi & F,
|
|
const Eigen::MatrixXi & F,
|
|
|
- const std::function<void(
|
|
|
|
|
- const int /*e*/,
|
|
|
|
|
- const Eigen::MatrixXd &/*V*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*F*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*E*/,
|
|
|
|
|
- const Eigen::VectorXi &/*EMAP*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*EF*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*EI*/,
|
|
|
|
|
- double & /*cost*/,
|
|
|
|
|
- Eigen::RowVectorXd & /*p*/
|
|
|
|
|
- )> & cost_and_placement,
|
|
|
|
|
- const std::function<bool(
|
|
|
|
|
- const Eigen::MatrixXd & ,/*V*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*F*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*E*/
|
|
|
|
|
- const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EF*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EI*/
|
|
|
|
|
- const std::set<std::pair<double,int> > & ,/*Q*/
|
|
|
|
|
- const std::vector<std::set<std::pair<double,int> >::iterator > &,/*Qit*/
|
|
|
|
|
- const Eigen::MatrixXd & ,/*C*/
|
|
|
|
|
- const int ,/*e*/
|
|
|
|
|
- const int ,/*e1*/
|
|
|
|
|
- const int ,/*e2*/
|
|
|
|
|
- const int ,/*f1*/
|
|
|
|
|
- const int /*f2*/
|
|
|
|
|
- )> & stopping_condition,
|
|
|
|
|
- const std::function<bool(
|
|
|
|
|
- const Eigen::MatrixXd & ,/*V*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*F*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*E*/
|
|
|
|
|
- const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EF*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EI*/
|
|
|
|
|
- const std::set<std::pair<double,int> > & ,/*Q*/
|
|
|
|
|
- const std::vector<std::set<std::pair<double,int> >::iterator > &,/*Qit*/
|
|
|
|
|
- const Eigen::MatrixXd & ,/*C*/
|
|
|
|
|
- const int /*e*/
|
|
|
|
|
- )> & pre_collapse,
|
|
|
|
|
- const std::function<void(
|
|
|
|
|
- const Eigen::MatrixXd & , /*V*/
|
|
|
|
|
- const Eigen::MatrixXi & , /*F*/
|
|
|
|
|
- const Eigen::MatrixXi & , /*E*/
|
|
|
|
|
- const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
- const Eigen::MatrixXi & , /*EF*/
|
|
|
|
|
- const Eigen::MatrixXi & , /*EI*/
|
|
|
|
|
- const std::set<std::pair<double,int> > & , /*Q*/
|
|
|
|
|
- const std::vector<std::set<std::pair<double,int> >::iterator > &, /*Qit*/
|
|
|
|
|
- const Eigen::MatrixXd & , /*C*/
|
|
|
|
|
- const int , /*e*/
|
|
|
|
|
- const int , /*e1*/
|
|
|
|
|
- const int , /*e2*/
|
|
|
|
|
- const int , /*f1*/
|
|
|
|
|
- const int , /*f2*/
|
|
|
|
|
- const bool /*collapsed*/
|
|
|
|
|
- )> & post_collapse,
|
|
|
|
|
|
|
+ const decimate_cost_and_placement_func & cost_and_placement,
|
|
|
|
|
+ const decimate_stopping_condition_func & stopping_condition,
|
|
|
|
|
+ const decimate_pre_collapse_func & pre_collapse,
|
|
|
|
|
+ const decimate_post_collapse_func & post_collapse,
|
|
|
Eigen::MatrixXd & U,
|
|
Eigen::MatrixXd & U,
|
|
|
Eigen::MatrixXi & G,
|
|
Eigen::MatrixXi & G,
|
|
|
Eigen::VectorXi & J,
|
|
Eigen::VectorXi & J,
|
|
@@ -181,62 +165,10 @@ namespace igl
|
|
|
IGL_INLINE bool decimate(
|
|
IGL_INLINE bool decimate(
|
|
|
const Eigen::MatrixXd & V,
|
|
const Eigen::MatrixXd & V,
|
|
|
const Eigen::MatrixXi & F,
|
|
const Eigen::MatrixXi & F,
|
|
|
- const std::function<void(
|
|
|
|
|
- const int /*e*/,
|
|
|
|
|
- const Eigen::MatrixXd &/*V*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*F*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*E*/,
|
|
|
|
|
- const Eigen::VectorXi &/*EMAP*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*EF*/,
|
|
|
|
|
- const Eigen::MatrixXi &/*EI*/,
|
|
|
|
|
- double & /*cost*/,
|
|
|
|
|
- Eigen::RowVectorXd & /*p*/
|
|
|
|
|
- )> & cost_and_placement,
|
|
|
|
|
- const std::function<bool(
|
|
|
|
|
- const Eigen::MatrixXd & ,/*V*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*F*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*E*/
|
|
|
|
|
- const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EF*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EI*/
|
|
|
|
|
- const std::set<std::pair<double,int> > & ,/*Q*/
|
|
|
|
|
- const std::vector<std::set<std::pair<double,int> >::iterator > &,/*Qit*/
|
|
|
|
|
- const Eigen::MatrixXd & ,/*C*/
|
|
|
|
|
- const int ,/*e*/
|
|
|
|
|
- const int ,/*e1*/
|
|
|
|
|
- const int ,/*e2*/
|
|
|
|
|
- const int ,/*f1*/
|
|
|
|
|
- const int /*f2*/
|
|
|
|
|
- )> & stopping_condition,
|
|
|
|
|
- const std::function<bool(
|
|
|
|
|
- const Eigen::MatrixXd & ,/*V*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*F*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*E*/
|
|
|
|
|
- const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EF*/
|
|
|
|
|
- const Eigen::MatrixXi & ,/*EI*/
|
|
|
|
|
- const std::set<std::pair<double,int> > & ,/*Q*/
|
|
|
|
|
- const std::vector<std::set<std::pair<double,int> >::iterator > &,/*Qit*/
|
|
|
|
|
- const Eigen::MatrixXd & ,/*C*/
|
|
|
|
|
- const int /*e*/
|
|
|
|
|
- )> & pre_collapse,
|
|
|
|
|
- const std::function<void(
|
|
|
|
|
- const Eigen::MatrixXd & , /*V*/
|
|
|
|
|
- const Eigen::MatrixXi & , /*F*/
|
|
|
|
|
- const Eigen::MatrixXi & , /*E*/
|
|
|
|
|
- const Eigen::VectorXi & ,/*EMAP*/
|
|
|
|
|
- const Eigen::MatrixXi & , /*EF*/
|
|
|
|
|
- const Eigen::MatrixXi & , /*EI*/
|
|
|
|
|
- const std::set<std::pair<double,int> > & , /*Q*/
|
|
|
|
|
- const std::vector<std::set<std::pair<double,int> >::iterator > &, /*Qit*/
|
|
|
|
|
- const Eigen::MatrixXd & , /*C*/
|
|
|
|
|
- const int , /*e*/
|
|
|
|
|
- const int , /*e1*/
|
|
|
|
|
- const int , /*e2*/
|
|
|
|
|
- const int , /*f1*/
|
|
|
|
|
- const int , /*f2*/
|
|
|
|
|
- const bool /*collapsed*/
|
|
|
|
|
- )> & post_collapse,
|
|
|
|
|
|
|
+ const decimate_cost_and_placement_func & cost_and_placement,
|
|
|
|
|
+ const decimate_stopping_condition_func & stopping_condition,
|
|
|
|
|
+ const decimate_pre_collapse_func & pre_collapse,
|
|
|
|
|
+ const decimate_post_collapse_func & post_collapse,
|
|
|
const Eigen::MatrixXi & E,
|
|
const Eigen::MatrixXi & E,
|
|
|
const Eigen::VectorXi & EMAP,
|
|
const Eigen::VectorXi & EMAP,
|
|
|
const Eigen::MatrixXi & EF,
|
|
const Eigen::MatrixXi & EF,
|