本文整理汇总了C++中ON_Brep::GetMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ ON_Brep::GetMesh方法的具体用法?C++ ON_Brep::GetMesh怎么用?C++ ON_Brep::GetMesh使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ON_Brep
的用法示例。
在下文中一共展示了ON_Brep::GetMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
vtkActor* gfxRhino3D::createActor(const ON_Object *object, double red, double green, double blue){
ON_Brep *brep;
ON_SimpleArray<const ON_Mesh*> cmsh;
int i, j, k, l, npts;
double x1,x2,x3,x4, y1,y2,y3,y4, z1,z2,z3,z4;
// Add Meshes to list
parentObject->points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> list = vtkSmartPointer<vtkCellArray>::New();
brep=0;
brep = (ON_Brep*)ON_Brep::Cast(object);
if (brep){
brep->GetMesh(ON::render_mesh, cmsh);
if (cmsh.Count()>0){
for (l=0;l<cmsh.Count();l++){
npts=parentObject->points->GetNumberOfPoints();
for (j=0;j<cmsh[l]->m_V.Count();j++) parentObject->points->InsertNextPoint(cmsh[l]->m_V[j].x, cmsh[l]->m_V[j].y, cmsh[l]->m_V[j].z);
for (j=0;j<cmsh[l]->m_F.Count();j++){
if (cmsh[l]->m_F[j].IsTriangle()){
vtkSmartPointer<vtkTriangle> triangle = vtkSmartPointer<vtkTriangle>::New();
for (k=0;k<3;k++) triangle->GetPointIds()->SetId(k,cmsh[l]->m_F[j].vi[k]+npts);
list->InsertNextCell(triangle);
}else{
vtkSmartPointer<vtkQuad> quad = vtkSmartPointer<vtkQuad>::New();
for (k=0;k<4;k++) quad->GetPointIds()->SetId(k,cmsh[l]->m_F[j].vi[k]+npts);
list->InsertNextCell(quad);
}
}
}
}
}
//Create a polydata object and add data
vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();
polydata->SetPoints(parentObject->points);
polydata->SetPolys(list);
//Create Mapper
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(polydata);
mapper->SetScalarRange(0.,1.);
//Create Actor
vtkActor *tmpActor = vtkActor::New();
tmpActor->SetMapper(mapper);
tmpActor->GetProperty()->SetInterpolationToGouraud();
// void SetInterpolationToFlat()
// void SetInterpolationToGouraud()
// void SetInterpolationToPhong()
tmpActor->GetProperty()->SetColor(red, green, blue);
return tmpActor;
}