本文整理汇总了C++中datacontainer::Pointer::getVertices方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::getVertices方法的具体用法?C++ Pointer::getVertices怎么用?C++ Pointer::getVertices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datacontainer::Pointer
的用法示例。
在下文中一共展示了Pointer::getVertices方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeVTKFile
void LaplacianSmoothing::writeVTKFile(const QString& outputVtkFile)
{
DataContainer::Pointer sm = getDataContainerArray()->getDataContainer(getSurfaceDataContainerName()); /* Place all your code to execute your filter here. */
VertexArray& nodes = *(sm->getVertices());
int nNodes = nodes.getNumberOfTuples();
bool m_WriteBinaryFile = true;
FILE* vtkFile = NULL;
vtkFile = fopen(outputVtkFile.toLatin1().data(), "wb");
if (NULL == vtkFile)
{
setErrorCondition(-90123);
QString ss = QObject::tr("Error creating file '%1'").arg(outputVtkFile);
notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
return;
}
Detail::ScopedFileMonitor vtkFileMonitor(vtkFile);
fprintf(vtkFile, "# vtk DataFile Version 2.0\n");
fprintf(vtkFile, "Data set from DREAM.3D Surface Meshing Module\n");
if (m_WriteBinaryFile)
{
fprintf(vtkFile, "BINARY\n");
}
else
{
fprintf(vtkFile, "ASCII\n");
}
fprintf(vtkFile, "DATASET POLYDATA\n");
fprintf(vtkFile, "POINTS %d float\n", nNodes);
float pos[3] = {0.0f, 0.0f, 0.0f};
size_t totalWritten = 0;
// Write the POINTS data (Vertex)
for (int i = 0; i < nNodes; i++)
{
VertexArray::Vert_t& n = nodes[i]; // Get the current Node
// if (m_SurfaceMeshNodeType[i] > 0)
{
pos[0] = static_cast<float>(n.pos[0]);
pos[1] = static_cast<float>(n.pos[1]);
pos[2] = static_cast<float>(n.pos[2]);
if (m_WriteBinaryFile == true)
{
DREAM3D::Endian::FromSystemToBig::convert<float>(pos[0]);
DREAM3D::Endian::FromSystemToBig::convert<float>(pos[1]);
DREAM3D::Endian::FromSystemToBig::convert<float>(pos[2]);
totalWritten = fwrite(pos, sizeof(float), 3, vtkFile);
if (totalWritten != sizeof(float) * 3)
{
}
}
else
{
fprintf(vtkFile, "%4.4f %4.4f %4.4f\n", pos[0], pos[1], pos[2]); // Write the positions to the output file
}
}
}
// Write the triangle indices into the vtk File
FaceArray& triangles = *(sm->getFaces());
int triangleCount = 0;
int end = triangles.getNumberOfTuples();
int featureInterest = 9;
for(int i = 0; i < end; ++i)
{
//FaceArray::Face_t* tri = triangles.getPointer(i);
if (m_SurfaceMeshFaceLabels[i * 2] == featureInterest || m_SurfaceMeshFaceLabels[i * 2 + 1] == featureInterest)
{
++triangleCount;
}
}
int tData[4];
// Write the CELLS Data
// int start = 3094380;
// int end = 3094450;
// int triangleCount = end - start;
qDebug() << "---------------------------------------------------------------------------" << "\n";
qDebug() << outputVtkFile << "\n";
fprintf(vtkFile, "\nPOLYGONS %d %d\n", triangleCount, (triangleCount * 4));
for (int tid = 0; tid < end; ++tid)
{
//FaceArray::Face_t* tri = triangles.getPointer(tid);
if (m_SurfaceMeshFaceLabels[tid * 2] == featureInterest || m_SurfaceMeshFaceLabels[tid * 2 + 1] == featureInterest)
{
tData[1] = triangles[tid].verts[0];
tData[2] = triangles[tid].verts[1];
tData[3] = triangles[tid].verts[2];
// qDebug() << tid << "\n " << nodes[tData[1]].coord[0] << " " << nodes[tData[1]].coord[1] << " " << nodes[tData[1]].coord[2] << "\n";
// qDebug() << " " << nodes[tData[2]].coord[0] << " " << nodes[tData[2]].coord[1] << " " << nodes[tData[2]].coord[2] << "\n";
// qDebug() << " " << nodes[tData[3]].coord[0] << " " << nodes[tData[3]].coord[1] << " " << nodes[tData[3]].coord[2] << "\n";
if (m_WriteBinaryFile == true)
{
tData[0] = 3; // Push on the total number of entries for this entry
//.........这里部分代码省略.........