------------------------------------------------------------------------------
| 159 | |
| 160 | //------------------------------------------------------------------------------ |
| 161 | bool vtkHyperTreeGridAxisClip::IsClipped(vtkHyperTreeGridNonOrientedGeometryCursor* cursor) |
| 162 | { |
| 163 | // Check clipping status depending on clip type |
| 164 | switch (this->ClipType) |
| 165 | { |
| 166 | case vtkHyperTreeGridAxisClip::PLANE: |
| 167 | { |
| 168 | // Retrieve normal axis and intercept of plane |
| 169 | int axis = this->PlaneNormalAxis; |
| 170 | double inter = this->PlanePosition; |
| 171 | |
| 172 | // Retrieve geometric origin of input cursor |
| 173 | const double* origin = cursor->GetOrigin(); |
| 174 | |
| 175 | // Retrieve geometric size of input cursor |
| 176 | const double* size = cursor->GetSize(); |
| 177 | |
| 178 | // Check if the cell pointed to by the cursor is under the plane: |
| 179 | // returns true if the cell is skipped |
| 180 | // returns false if the cell is kept |
| 181 | return this->InsideOut ? (origin[axis] > inter) : (origin[axis] + size[axis] < inter); |
| 182 | } // case PLANE |
| 183 | case vtkHyperTreeGridAxisClip::BOX: |
| 184 | { |
| 185 | // Retrieve bounds of box |
| 186 | double bMin[3], bMax[3]; |
| 187 | this->GetMinimumBounds(bMin); |
| 188 | this->GetMaximumBounds(bMax); |
| 189 | |
| 190 | // Retrieve geometric origin and size of input cursor |
| 191 | const double* cMin = cursor->GetOrigin(); |
| 192 | const double* size = cursor->GetSize(); |
| 193 | |
| 194 | // Compute upper bounds of input cursor |
| 195 | double cMax[3]; |
| 196 | cMax[0] = cMin[0] + size[0]; |
| 197 | cMax[1] = cMin[1] + size[1]; |
| 198 | cMax[2] = cMin[2] + size[2]; |
| 199 | |
| 200 | if (((cMin[0] >= bMin[0] && cMin[0] <= bMax[0]) || |
| 201 | (cMax[0] >= bMin[0] && cMax[0] <= bMax[0])) && |
| 202 | ((cMin[1] >= bMin[1] && cMin[1] <= bMax[1]) || |
| 203 | (cMax[1] >= bMin[1] && cMax[1] <= bMax[1])) && |
| 204 | ((cMin[2] >= bMin[2] && cMin[2] <= bMax[2]) || (cMax[2] >= bMin[2] && cMax[2] <= bMax[2]))) |
| 205 | { |
| 206 | return this->InsideOut; |
| 207 | } |
| 208 | return !this->InsideOut; |
| 209 | } // case BOX |
| 210 | case vtkHyperTreeGridAxisClip::QUADRIC: |
| 211 | { |
| 212 | // Retrieve geometric origin and size of input cursor |
| 213 | const double* origin = cursor->GetOrigin(); |
| 214 | const double* size = cursor->GetSize(); |
| 215 | |
| 216 | // Iterate over all vertices |
| 217 | double nVert = 1 << cursor->GetDimension(); |
| 218 | for (int v = 0; v < nVert; ++v) |
no test coverage detected