本文整理汇总了C++中MDoubleArray::set方法的典型用法代码示例。如果您正苦于以下问题:C++ MDoubleArray::set方法的具体用法?C++ MDoubleArray::set怎么用?C++ MDoubleArray::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDoubleArray
的用法示例。
在下文中一共展示了MDoubleArray::set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readNurbs
MObject readNurbs(double iFrame, Alembic::AbcGeom::INuPatch & iNode,
MObject & iObject)
{
MStatus status;
MObject obj;
Alembic::AbcGeom::INuPatchSchema schema = iNode.getSchema();
// no interpolation for now
Alembic::AbcCoreAbstract::index_t index, ceilIndex;
getWeightAndIndex(iFrame, schema.getTimeSampling(),
schema.getNumSamples(), index, ceilIndex);
Alembic::AbcGeom::INuPatchSchema::Sample samp;
schema.get(samp, Alembic::Abc::ISampleSelector(index));
Alembic::Abc::P3fArraySamplePtr pos = samp.getPositions();
Alembic::Abc::FloatArraySamplePtr weights = samp.getPositionWeights();
MString surfaceName(iNode.getName().c_str());
unsigned int degreeU = samp.getUOrder() - 1;
unsigned int degreeV = samp.getVOrder() - 1;
unsigned int numCVInU = samp.getNumU();
unsigned int numCVInV = samp.getNumV();
// cv points
unsigned int numCV = numCVInU*numCVInV;
unsigned int curPos = 0;
MPointArray controlVertices;
controlVertices.setLength(numCV);
for (unsigned int v = 0; v < numCVInV; ++v)
{
for (unsigned int u = 0; u < numCVInU; ++u, ++curPos)
{
unsigned int mayaIndex = u * numCVInV + (numCVInV - v - 1);
MPoint pt((*pos)[curPos].x, (*pos)[curPos].y, (*pos)[curPos].z);
if (weights)
{
pt.w = (*weights)[curPos];
}
// go from u,v order to reversed v, u order
controlVertices.set(pt, mayaIndex);
}
}
// Nurbs form
// Alemblic file does not record the form of nurb surface, we get the form
// by checking the CV data. If the first degree number CV overlap the last
// degree number CV, then the form is kPeriodic. If only the first CV overlaps
// the last CV, then the form is kClosed.
MFnNurbsSurface::Form formU = MFnNurbsSurface::kPeriodic;
MFnNurbsSurface::Form formV = MFnNurbsSurface::kPeriodic;
// Check all curves
bool notOpen = true;
for (unsigned int v = 0; notOpen && v < numCVInV; v++) {
for (unsigned int u = 0; u < degreeU; u++) {
unsigned int firstIndex = u * numCVInV + (numCVInV - v - 1);
unsigned int lastPeriodicIndex = (numCVInU - degreeU + u) * numCVInV + (numCVInV - v - 1);
if (!controlVertices[firstIndex].isEquivalent(controlVertices[lastPeriodicIndex])) {
formU = MFnNurbsSurface::kOpen;
notOpen = false;
break;
}
}
}
if (formU == MFnNurbsSurface::kOpen) {
formU = MFnNurbsSurface::kClosed;
for (unsigned int v = 0; v < numCVInV; v++) {
unsigned int lastUIndex = (numCVInU - 1) * numCVInV + (numCVInV - v - 1);
if (! controlVertices[numCVInV-v-1].isEquivalent(controlVertices[lastUIndex])) {
formU = MFnNurbsSurface::kOpen;
break;
}
}
}
notOpen = true;
for (unsigned int u = 0; notOpen && u < numCVInU; u++) {
for (unsigned int v = 0; v < degreeV; v++) {
unsigned int firstIndex = u * numCVInV + (numCVInV - v - 1);
unsigned int lastPeriodicIndex = u * numCVInV + (degreeV - v - 1); //numV - (numV - vDegree + v) - 1;
if (!controlVertices[firstIndex].isEquivalent(controlVertices[lastPeriodicIndex])) {
formV = MFnNurbsSurface::kOpen;
notOpen = false;
break;
}
}
}
if (formV == MFnNurbsSurface::kOpen) {
formV = MFnNurbsSurface::kClosed;
for (unsigned int u = 0; u < numCVInU; u++) {
if (! controlVertices[u * numCVInV + (numCVInV-1)].isEquivalent(controlVertices[u * numCVInV])) {
formV = MFnNurbsSurface::kOpen;
break;
//.........这里部分代码省略.........