17 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
21 #include <vtkImageData.h>
22 #include <vtkIdList.h>
24 #include <vtkPoints.h>
37 class axlVolumeDiscreteConverterPrivate
60 return "axlVolumeDiscreteConverter";
65 return "Converter from axlVolume to axlMesh";
70 return QStringList() <<
"axlVolumeDiscreteConverter" <<
"axlVolume" ;
89 vtkImageData *grid =
static_cast<vtkImageData *
>(d->data->data());
92 QVector<axlPoint *> listPoints;
93 int nbPoints = grid->GetNumberOfPoints();
95 for(
int i = 0; i <nbPoints;i++){
103 QVector<int> listFaces;
104 QVector<int> listEdges;
106 vtkCell *currentCell;
107 vtkCell *currentFace;
108 vtkCell *currentEdge;
120 int nbCells = grid->GetNumberOfCells();
121 for(
int ic = 0 ; ic < nbCells ; ic++){
122 currentCell = grid->GetCell(ic);
123 faces = currentCell->GetNumberOfFaces();
124 edges = currentCell->GetNumberOfEdges();
127 for(
int jf= 0 ;jf < faces;jf++){
128 currentFace = currentCell->GetFace(jf);
129 list = currentFace->GetPoints();
130 points = list->GetNumberOfPoints();
131 if(!listFaces.empty()){
134 for (
int jp = 0; jp < points; jp ++){
135 id = currentFace->GetPointId(jp);
136 listFaces.append(
id);
139 std::vector<int> vectorFace = listFaces.toStdVector();
140 std::sort (vectorFace.begin(), vectorFace.end());
141 listFaces = QVector<int>::fromStdVector(vectorFace);
142 first = listFaces.first();
143 second = listFaces.at(1);
144 third = listFaces.at(2);
145 last = listFaces.last();
152 for(
int je= 0 ;je < edges;je++){
153 currentEdge = currentCell->GetEdge(je);
154 list = currentEdge->GetPoints();
155 points = list->GetNumberOfPoints();
156 if(!listEdges.empty()){
159 for (
int jp = 0; jp < points; jp ++){
160 id = currentEdge->GetPointId(jp);
161 listEdges.append(
id);
static bool registered(void)
Class axlPoint defines 3D points.
void noDuplicateVertices(void)
Remove duplicated vertices.
void setData(dtkAbstractData *data)
QStringList fromTypes(void) const
void push_back_edge(int, int)
QString description(void) const
axlVolumeDiscreteConverter(void)
QString identifier(void) const
~axlVolumeDiscreteConverter(void)
void setVertices(const QVector< axlPoint * > &pointSet)
void push_back_face(const Face &face)
dtkAbstractDataConverter * createaxlVolumeDiscreteConverter(void)
QString toType(void) const
static dtkAbstractDataFactory * dataFactSingleton
Class axlMesh defines a piecewise-linear 3D object.