Changeset 4385 for trunk


Ignore:
Timestamp:
Jun 12, 2014 9:27:21 AM (10 years ago)
Author:
ldelgass
Message:

Fix out-of-bounds points when resampling: don't consider out-of-boudnds points
in field min/max, set to normalized min.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/VtkDataSetReader.cpp

    r4164 r4385  
    109109    int iy = 0;
    110110    int iz = 0;
     111    vtkDataArray *mask = resampledDataSet->GetPointData()->GetArray("vtkValidPointMask");
    111112    for (int p = 0; p < npts; p++) {
    112113        int nindex = p * 4;
    113114        double val;
     115        int loc[3];
     116        loc[0] = ix; loc[1] = iy; loc[2] = iz;
     117        vtkIdType idx = resampledDataSet->ComputePointId(loc);
     118        bool valid = (mask->GetComponent(idx, 0) != 0.0);
    114119        if (isVectorData) {
    115120            double vec[3];
    116             int loc[3];
    117             loc[0] = ix; loc[1] = iy; loc[2] = iz;
    118             vtkIdType idx = resampledDataSet->ComputePointId(loc);
    119121            resampledDataSet->GetPointData()->GetVectors()->GetTuple(idx, vec);
    120122            val = sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]);
     
    124126            data[nindex+3] = (float)vec[2];
    125127        } else {
    126             val = resampledDataSet->GetScalarComponentAsDouble(ix, iy, iz, 0);
    127             data[nindex] = (float)val;
     128            //val = resampledDataSet->GetScalarComponentAsDouble(ix, iy, iz, 0);
     129            val = resampledDataSet->GetPointData()->GetScalars()->GetComponent(idx, 0);
     130            data[nindex] = valid ? (float)val : -FLT_MAX;
    128131        }
    129          if (val < vmin) {
    130             vmin = val;
    131         } else if (val > vmax) {
    132             vmax = val;
    133         }
    134         if (val != 0.0 && val < nzero_min) {
    135             nzero_min = val;
     132        if (valid) {
     133            if (val < vmin) {
     134                vmin = val;
     135            } else if (val > vmax) {
     136                vmax = val;
     137            }
     138            if (val != 0.0 && val < nzero_min) {
     139                nzero_min = val;
     140            }
    136141        }
    137142
Note: See TracChangeset for help on using the changeset viewer.