void countVertices(MeshGroup const & mg, long & num_vertices) { for (MeshGroup::MeshConstIterator mi = mg.meshesBegin(); mi != mg.meshesEnd(); ++mi) num_vertices += (*mi)->numVertices(); for (MeshGroup::GroupConstIterator ci = mg.childrenBegin(); ci != mg.childrenEnd(); ++ci) countVertices(**ci, num_vertices); }
// A rather hacky way of forming a joint descriptor, suitable only for exact matches like we want here void accumGroupFeatures(MeshGroup const & mg, TheaArray<double> & features) { for (MeshGroup::MeshConstIterator mi = mg.meshesBegin(); mi != mg.meshesEnd(); ++mi) { TheaArray<double> const & mf = (*mi)->getFeatures(); if (features.empty()) features.resize(mf.size()); alwaysAssertM(mf.size() == features.size(), "Feature vectors have different sizes"); for (array_size_t j = 0; j < features.size(); ++j) features[j] += mf[j]; } for (MeshGroup::GroupConstIterator ci = mg.childrenBegin(); ci != mg.childrenEnd(); ++ci) accumGroupFeatures(**ci, features); }