本文整理汇总了C++中eigen::PlainObjectBase::derived方法的典型用法代码示例。如果您正苦于以下问题:C++ PlainObjectBase::derived方法的具体用法?C++ PlainObjectBase::derived怎么用?C++ PlainObjectBase::derived使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::PlainObjectBase
的用法示例。
在下文中一共展示了PlainObjectBase::derived方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vertex_triangle_adjacency
IGL_INLINE void igl::vertex_triangle_adjacency(
const Eigen::MatrixBase<DerivedF> & F,
const int n,
Eigen::PlainObjectBase<DerivedVF> & VF,
Eigen::PlainObjectBase<DerivedNI> & NI)
{
typedef Eigen::Matrix<typename DerivedVF::Scalar,Eigen::Dynamic,1> VectorXI;
// vfd #V list so that vfd(i) contains the vertex-face degree (number of
// faces incident on vertex i)
VectorXI vfd = VectorXI::Zero(n);
for (int i = 0; i < F.rows(); i++)
{
for (int j = 0; j < 3; j++)
{
vfd[F(i,j)]++;
}
}
igl::cumsum(vfd,1,NI);
// Prepend a zero
NI = (DerivedNI(n+1)<<0,NI).finished();
// vfd now acts as a counter
vfd = NI;
VF.derived()= Eigen::VectorXi(3*F.rows());
for (int i = 0; i < F.rows(); i++)
{
for (int j = 0; j < 3; j++)
{
VF[vfd[F(i,j)]] = i;
vfd[F(i,j)]++;
}
}
}
示例2: bbw
IGL_INLINE bool igl::bbw(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedEle> & Ele,
const Eigen::PlainObjectBase<Derivedb> & b,
const Eigen::PlainObjectBase<Derivedbc> & bc,
igl::BBWData & data,
Eigen::PlainObjectBase<DerivedW> & W
)
{
using namespace igl;
using namespace std;
using namespace Eigen;
// number of domain vertices
int n = V.rows();
// number of handles
int m = bc.cols();
SparseMatrix<typename DerivedW::Scalar> L;
cotmatrix(V,Ele,L);
MassMatrixType mmtype = MASSMATRIX_VORONOI;
if(Ele.cols() == 4)
{
mmtype = MASSMATRIX_BARYCENTRIC;
}
SparseMatrix<typename DerivedW::Scalar> M;
SparseMatrix<typename DerivedW::Scalar> Mi;
massmatrix(V,Ele,mmtype,M);
invert_diag(M,Mi);
// Biharmonic operator
SparseMatrix<typename DerivedW::Scalar> Q = L.transpose() * Mi * L;
W.derived().resize(n,m);
if(data.partition_unity)
{
// Not yet implemented
assert(false);
}else
{
// No linear terms
VectorXd c = VectorXd::Zero(n);
// No linear constraints
SparseMatrix<typename DerivedW::Scalar> A(0,n),Aeq(0,n),Aieq(0,n);
VectorXd uc(0,1),Beq(0,1),Bieq(0,1),lc(0,1);
// Upper and lower box constraints (Constant bounds)
VectorXd ux = VectorXd::Ones(n);
VectorXd lx = VectorXd::Zero(n);
active_set_params eff_params = data.active_set_params;
switch(data.qp_solver)
{
case QP_SOLVER_IGL_ACTIVE_SET:
{
//if(data.verbosity >= 1)
//{
cout<<"BBW: max_iter: "<<eff_params.max_iter<<endl;
//}
if(data.verbosity >= 1)
{
cout<<"BBW: Computing initial weights for "<<m<<" handle"<<
(m!=1?"s":"")<<"."<<endl;
}
min_quad_with_fixed_data<typename DerivedW::Scalar > mqwf;
min_quad_with_fixed_precompute(Q,b,Aeq,true,mqwf);
min_quad_with_fixed_solve(mqwf,c,bc,Beq,W);
// decrement
eff_params.max_iter--;
bool error = false;
// Loop over handles
#pragma omp parallel for
for(int i = 0;i<m;i++)
{
// Quicker exit for openmp
if(error)
{
continue;
}
if(data.verbosity >= 1)
{
#pragma omp critical
cout<<"BBW: Computing weight for handle "<<i+1<<" out of "<<m<<
"."<<endl;
}
VectorXd bci = bc.col(i);
VectorXd Wi;
// use initial guess
Wi = W.col(i);
SolverStatus ret = active_set(
Q,c,b,bci,Aeq,Beq,Aieq,Bieq,lx,ux,eff_params,Wi);
switch(ret)
{
case SOLVER_STATUS_CONVERGED:
break;
case SOLVER_STATUS_MAX_ITER:
cerr<<"active_set: max iter without convergence."<<endl;
break;
case SOLVER_STATUS_ERROR:
default:
cerr<<"active_set error."<<endl;
//.........这里部分代码省略.........