MCPcopy Create free account
hub / github.com/Kitware/VTK / GetDistance2ToBoundaryPrivate

Method GetDistance2ToBoundaryPrivate

Common/DataModel/vtkKdNode.cxx:266–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266double vtkKdNode::GetDistance2ToBoundaryPrivate(double x, double y, double z, // from this point
267 double* p, // set to point on boundary that is closest
268 int innerBoundaryOnly, // ignore boundaries on "outside"
269 int useDataBounds = 0) // use bounds of data within region instead
270{
271 double minDistance, dist;
272 double edgePt[3];
273 double cornerPt[3];
274 double pt3[3];
275
276 double *min, *max;
277
278 if (useDataBounds)
279 {
280 min = this->MinVal;
281 max = this->MaxVal; // data inside region
282 }
283 else
284 {
285 min = this->Min;
286 max = this->Max; // region itself
287 }
288
289 double* outerBoundaryMin = nullptr;
290 double* outerBoundaryMax = nullptr;
291
292 if (innerBoundaryOnly)
293 {
294 // We want the distance to the nearest inner boundary, because we are only
295 // interested in boundaries such that there may be points on the other
296 // side. This option only makes sense when the point supplied is
297 // inside this node (region).
298
299 vtkKdNode* top = this;
300 vtkKdNode* up = this->Up;
301
302 while (up)
303 {
304 top = up;
305 up = up->Up;
306 }
307
308 outerBoundaryMin = (useDataBounds ? top->MinVal : top->Min);
309 outerBoundaryMax = (useDataBounds ? top->MaxVal : top->Max);
310 }
311
312 double xmax = max[0];
313 double ymax = max[1];
314 double zmax = max[2];
315 double xmin = min[0];
316 double ymin = min[1];
317 double zmin = min[2];
318
319 int xless = (x < xmin);
320 int xmore = (x > xmax);
321 int yless = (y < ymin);
322 int ymore = (y > ymax);
323 int zless = (z < zmin);

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected