本文整理汇总了C++中eigen::MatrixXi::col方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixXi::col方法的具体用法?C++ MatrixXi::col怎么用?C++ MatrixXi::col使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eigen::MatrixXi
的用法示例。
在下文中一共展示了MatrixXi::col方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
using namespace Eigen;
using namespace std;
// Load a quad mesh generated by a conjugate field
igl::readOFF(TUTORIAL_SHARED_PATH "/inspired_mesh_quads_Conjugate.off", VQC, FQC);
// Convert it in a triangle mesh
FQCtri.resize(2*FQC.rows(), 3);
FQCtri << FQC.col(0),FQC.col(1),FQC.col(2),
FQC.col(2),FQC.col(3),FQC.col(0);
igl::slice( VQC, FQC.col(0).eval(), 1, PQC0);
igl::slice( VQC, FQC.col(1).eval(), 1, PQC1);
igl::slice( VQC, FQC.col(2).eval(), 1, PQC2);
igl::slice( VQC, FQC.col(3).eval(), 1, PQC3);
// Planarize it
igl::planarize_quad_mesh(VQC, FQC, 100, 0.005, VQCplan);
// Convert the planarized mesh to triangles
igl::slice( VQCplan, FQC.col(0).eval(), 1, PQC0plan);
igl::slice( VQCplan, FQC.col(1).eval(), 1, PQC1plan);
igl::slice( VQCplan, FQC.col(2).eval(), 1, PQC2plan);
igl::slice( VQCplan, FQC.col(3).eval(), 1, PQC3plan);
// Launch the viewer
igl::viewer::Viewer viewer;
key_down(viewer,'2',0);
viewer.data.invert_normals = true;
viewer.data.show_lines = false;
viewer.callback_key_down = &key_down;
viewer.launch();
}
示例2: incidence
int NuTo::Structure::ElementsCreate(int rInterpolationTypeId, const Eigen::MatrixXi& rNodeNumbers)
{
std::vector<int> newElementIds;
// go through the elements
for (int iNode = 0; iNode < rNodeNumbers.cols(); ++iNode)
{
auto column = rNodeNumbers.col(iNode);
std::vector<int> incidence(column.data(), column.data() + column.size());
int newElementId = ElementCreate(rInterpolationTypeId, incidence);
newElementIds.push_back(newElementId);
}
bool showTime = mShowTime;
mShowTime = false;
// create element group containing the new elements
int newElementGroup = GroupCreate(eGroupId::Elements);
for (int newElementId : newElementIds)
GroupAddElement(newElementGroup, newElementId);
mShowTime = showTime;
return newElementGroup;
}
示例3: arap_dof_precomputation
IGL_INLINE bool igl::arap_dof_precomputation(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const LbsMatrixType & M,
const Eigen::Matrix<int,Eigen::Dynamic,1> & G,
ArapDOFData<LbsMatrixType, SSCALAR> & data)
{
using namespace Eigen;
typedef Matrix<SSCALAR, Dynamic, Dynamic> MatrixXS;
// number of mesh (domain) vertices
int n = V.rows();
// cache problem size
data.n = n;
// dimension of mesh
data.dim = V.cols();
assert(data.dim == M.rows()/n);
assert(data.dim*n == M.rows());
if(data.dim == 3)
{
// Check if z-coordinate is all zeros
if(V.col(2).minCoeff() == 0 && V.col(2).maxCoeff() == 0)
{
data.effective_dim = 2;
}
}else
{
data.effective_dim = data.dim;
}
// Number of handles
data.m = M.cols()/data.dim/(data.dim+1);
assert(data.m*data.dim*(data.dim+1) == M.cols());
//assert(m == C.rows());
//printf("n=%d; dim=%d; m=%d;\n",n,data.dim,data.m);
// Build cotangent laplacian
SparseMatrix<double> Lcot;
//printf("cotmatrix()\n");
cotmatrix(V,F,Lcot);
// Discrete laplacian (should be minus matlab version)
SparseMatrix<double> Lapl = -2.0*Lcot;
#ifdef EXTREME_VERBOSE
cout<<"LaplIJV=["<<endl;print_ijv(Lapl,1);cout<<endl<<"];"<<
endl<<"Lapl=sparse(LaplIJV(:,1),LaplIJV(:,2),LaplIJV(:,3),"<<
Lapl.rows()<<","<<Lapl.cols()<<");"<<endl;
#endif
// Get group sum scatter matrix, when applied sums all entries of the same
// group according to G
SparseMatrix<double> G_sum;
if(G.size() == 0)
{
speye(n,G_sum);
}else
{
// groups are defined per vertex, convert to per face using mode
Eigen::Matrix<int,Eigen::Dynamic,1> GG;
if(data.energy == ARAP_ENERGY_TYPE_ELEMENTS)
{
MatrixXi GF(F.rows(),F.cols());
for(int j = 0;j<F.cols();j++)
{
Matrix<int,Eigen::Dynamic,1> GFj;
slice(G,F.col(j),GFj);
GF.col(j) = GFj;
}
mode<int>(GF,2,GG);
}else
{
GG=G;
}
//printf("group_sum_matrix()\n");
group_sum_matrix(GG,G_sum);
}
#ifdef EXTREME_VERBOSE
cout<<"G_sumIJV=["<<endl;print_ijv(G_sum,1);cout<<endl<<"];"<<
endl<<"G_sum=sparse(G_sumIJV(:,1),G_sumIJV(:,2),G_sumIJV(:,3),"<<
G_sum.rows()<<","<<G_sum.cols()<<");"<<endl;
#endif
// Get covariance scatter matrix, when applied collects the covariance matrices
// used to fit rotations to during optimization
SparseMatrix<double> CSM;
//printf("covariance_scatter_matrix()\n");
covariance_scatter_matrix(V,F,data.energy,CSM);
#ifdef EXTREME_VERBOSE
cout<<"CSMIJV=["<<endl;print_ijv(CSM,1);cout<<endl<<"];"<<
endl<<"CSM=sparse(CSMIJV(:,1),CSMIJV(:,2),CSMIJV(:,3),"<<
CSM.rows()<<","<<CSM.cols()<<");"<<endl;
#endif
// Build the covariance matrix "constructor". This is a set of *scatter*
// matrices that when multiplied on the right by column of the transformation
// matrix entries (the degrees of freedom) L, we get a stack of dim by 1
// covariance matrix column, with a column in the stack for each rotation
// *group*. The output is a list of matrices because we construct each column
// in the stack of covariance matrices with an independent matrix-vector
// multiplication.
//.........这里部分代码省略.........