本文整理汇总了C++中McDArray::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ McDArray::resize方法的具体用法?C++ McDArray::resize怎么用?C++ McDArray::resize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类McDArray
的用法示例。
在下文中一共展示了McDArray::resize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preparePoints
void HxCPDSpatialGraphWarp::preparePoints(McDArray<McVec3f>& p1,
McDArray<McVec3f>& p2,
SpatialGraphSelection& slice2,
const HxSpatialGraph* spatialGraph) {
ma::SliceSelector selectionHelper(spatialGraph, "TransformInfo");
ma::EndPointParams params;
params.endPointRegion = 30;
params.projectionPlane = selectionHelper.computeMidPlane(0, 1);
params.projectionType = ma::P_ORTHOGONAL;
params.refSliceNum = 0;
params.transSliceNum = 1;
params.useAbsoluteValueForEndPointRegion = false;
params.maxDistForAngle = 2000;
params.angleToPlaneFilter = 0.01;
SpatialGraphSelection slice1;
ma::FacingPointSets pr =
ma::projectEndPoints(spatialGraph, slice1, slice2, params);
McDArray<McVec3f> refCoords = pr.ref.positions;
McDArray<McVec3f> transCoords = pr.trans.positions;
mcassert(refCoords.size() == slice1.getNumSelectedVertices());
mcassert(transCoords.size() == slice2.getNumSelectedVertices());
p1.resize(refCoords.size());
for (int i = 0; i < refCoords.size(); i++) {
McVec3f coord = refCoords[i];
p1[i] = McVec3f(coord.x, coord.y, 0);
}
p2.resize(transCoords.size());
for (int i = 0; i < transCoords.size(); i++) {
McVec3f coord = transCoords[i];
p2[i] = McVec3f(coord.x, coord.y, 0);
}
mcassert(p2.size() == slice2.getNumSelectedVertices());
}
示例2: getAssignmentsForVariable
void BruteForceOptMatching::getAssignmentsForVariable(
const int variableLabel,
McDArray<int>& indicesThisVariableCanBeAssignedTo) {
indicesThisVariableCanBeAssignedTo.resize(0);
for (int i = 0; i < mVariableAssignmentMat.nCols(); i++) {
if (mVariableAssignmentMat[variableLabel][i] > 0)
indicesThisVariableCanBeAssignedTo.append(i);
}
}
示例3:
static McDArray<McVec2d> asVec2dArray(const McDArray<McVec3f>& a) {
McDArray<McVec2d> b;
b.resize(a.size());
for (long i = 0; i < a.size(); i++) {
b[i].x = a[i].x;
b[i].y = a[i].y;
}
return b;
}
示例4: prepareLandmarks
void HxMovingLeastSquaresWarp::prepareLandmarks(McDArray<McVec2d>& p1,
McDArray<McVec2d>& p2) {
int set1 = 0;
int set2 = 1;
HxLandmarkSet* pointSet = hxconnection_cast<HxLandmarkSet>(portData);
if (!pointSet)
return;
p1.resize(0);
p2.resize(0);
int nPoints = pointSet->getNumMarkers();
for (int i = 0; i < nPoints; i++) {
p1.append(McVec2d(pointSet->getCoords(set1)[i].x,
pointSet->getCoords(set1)[i].y));
p2.append(McVec2d(pointSet->getCoords(set2)[i].x,
pointSet->getCoords(set2)[i].y));
}
}
示例5: getAssignedValuesForVar
void BruteForceOptMatching::getAssignedValuesForVar(
const McDMatrix<float>& allValues,
const McDMatrix<int>& variableAssignmentMat,
const McDArray<int>& possibleAssignments, const int label,
const float zeroVal, McDArray<float>& values) {
values.resize(0);
for (int i = 0; i < possibleAssignments.size(); i++) {
if (variableAssignmentMat[label][possibleAssignments[i]] > 1.e-6) {
values.append(allValues[label][possibleAssignments[i]]);
} else
values.append(zeroVal);
}
}
示例6: getConnectedComponent
// Computes all variables that form a connected component in the
// adjacenceMatrix.
// The connected component chosen is arbitrary - it takes the first it finds.
bool BruteForceOptMatching::getConnectedComponent(
const McDMatrix<int>& adjacenceMatrix,
McDMatrix<int>& adjacenceMatrixWithoutConnctedComponent,
McDArray<int>& connComp) {
adjacenceMatrixWithoutConnctedComponent.resize(adjacenceMatrix.nRows(),
adjacenceMatrix.nCols());
memcpy(adjacenceMatrixWithoutConnctedComponent.dataPtr(),
adjacenceMatrix.dataPtr(),
sizeof(int) * adjacenceMatrix.nRows() * adjacenceMatrix.nCols());
// find first a startpoint
int start = -1;
connComp.resize(0);
for (int i = 0; i < adjacenceMatrix.nRows(); i++) {
for (int j = i; j < adjacenceMatrix.nCols(); j++) {
if (adjacenceMatrix[i][j] == 1) {
start = i;
break;
}
}
}
if (start == -1)
return false;
McDArray<int> queue;
queue.append(start);
connComp.clear();
while (queue.size() > 0) {
int cur = queue.last();
connComp.append(cur);
queue.pop_back();
for (int i = 0; i < adjacenceMatrixWithoutConnctedComponent.nCols();
i++) {
if (adjacenceMatrixWithoutConnctedComponent[cur][i] == 1) {
queue.push(i);
adjacenceMatrixWithoutConnctedComponent[cur][i] = 0;
}
}
}
// remove duplicates
connComp.sort(&mcStandardCompare);
int cur = connComp.last();
for (int i = connComp.size() - 2; i >= 0; i--) {
if (cur == connComp[i])
connComp.remove(i, 1);
else
cur = connComp[i];
}
return true;
}
示例7: getSingletonProbs
void BruteForceOptMatching::getSingletonProbs(
const McDMatrix<float>& angleMatrix,
const McDMatrix<float>& projDistanceMatrix,
const McDMatrix<float>& distanceMatrix3d,
const McDMatrix<int>& variableAssignmentMat,
const McDArray<int>& assignments, const int varLabel,
McDArray<double>& probs) {
McDArray<float> floatProbs;
getSingletonProbs(angleMatrix, projDistanceMatrix, distanceMatrix3d,
variableAssignmentMat, assignments, varLabel, floatProbs);
probs.resize(floatProbs.size());
for (int i = 0; i < floatProbs.size(); ++i)
probs[i] = floatProbs[i];
}