コード例 #1
0
// ****************************************************************************
//  Modifications:
//    Jeremy Meredith, Mon Feb 16 19:11:34 PST 2004
//    Added polygonal cell support.
//
//    Hank Childs, Thu Oct 21 07:52:31 PDT 2004
//    Instead of duplicating code, just call a common function.
//    (Moved whole routine to new ConstructDataSet method with 
//     CommonPointsStructure in signature).
//
//    Brad Whitlock, Thu Mar 22 12:36:10 PDT 2012
//    Call ConstructDataSetHelper.
//
// ****************************************************************************
void
vtkVolumeFromVolume::ConstructDataSet(vtkPointData *inPD, vtkCellData *inCD,
                                      vtkUnstructuredGrid *output,
                                      const int *dims, vtkDataArray *X, vtkDataArray *Y, vtkDataArray *Z)
{
    int tx = X->GetDataType();
    int ty = Y->GetDataType();
    int tz = Z->GetDataType();
    bool same = tx == ty && ty == tz;
    if(same && tx == VTK_FLOAT)
        ConstructDataSetHelper(inPD, inCD, output, VTK_FLOAT, this->numPrevPts,
                               this->shapes, this->nshapes, 
                               this->pt_list, this->centroid_list, 
                               vtkRectPointAccessor<float>(dims, X, Y, Z));
    else if(same && tx == VTK_DOUBLE)
        ConstructDataSetHelper(inPD, inCD, output, VTK_DOUBLE, this->numPrevPts, 
                               this->shapes, this->nshapes, 
                               this->pt_list, this->centroid_list, 
                               vtkRectPointAccessor<double>(dims, X, Y, Z));
    else
        ConstructDataSetHelper(inPD, inCD, output, VTK_FLOAT, this->numPrevPts,
                               this->shapes, this->nshapes, 
                               this->pt_list, this->centroid_list, 
                               vtkGeneralRectPointAccessor(dims, X, Y, Z));
}
コード例 #2
0
void
vtkSurfaceFromVolume::ConstructPolyData(vtkPointData *inPD, vtkCellData *inCD,
    vtkPolyData *output, int *dims, 
    vtkDataArray *X, vtkDataArray *Y, vtkDataArray *Z)
{
    int tx = X->GetDataType();
    int ty = Y->GetDataType();
    int tz = Z->GetDataType();
    bool same = tx == ty && ty == tz;
    if(same && tx == VTK_FLOAT)
        ConstructPolyDataHelper(inPD, inCD, output, this->pt_list, this->tris, tx, vtkRectPointAccessor<float>(dims, X, Y, Z));
    else if(same && tx == VTK_DOUBLE)
        ConstructPolyDataHelper(inPD, inCD, output, this->pt_list, this->tris, tx, vtkRectPointAccessor<double>(dims, X, Y, Z));
    else
        ConstructPolyDataHelper(inPD, inCD, output, this->pt_list, this->tris, tx, vtkGeneralRectPointAccessor(dims, X, Y, Z));
}