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

Method IntersectWithLine

Rendering/Core/vtkCellPicker.cxx:269–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267#define VTKCELLPICKER_PLANE_TOL 1e-14
268
269double vtkCellPicker::IntersectWithLine(const double p1[3], const double p2[3], double tol,
270 vtkAssemblyPath* path, vtkProp3D* prop, vtkAbstractMapper3D* m)
271{
272 vtkMapper* mapper = nullptr;
273 vtkAbstractVolumeMapper* volumeMapper = nullptr;
274 vtkImageMapper3D* imageMapper = nullptr;
275 vtkAbstractHyperTreeGridMapper* htgMapper = nullptr;
276
277 double tMin = VTK_DOUBLE_MAX;
278 double t1 = 0.0;
279 double t2 = 1.0;
280
281 // Clip the ray with the mapper's ClippingPlanes and adjust t1, t2.
282 // This limits the pick search to the inside of the clipped region.
283 int clippingPlaneId = -1;
284 if (m &&
285 !vtkCellPicker::ClipLineWithPlanes(
286 m, this->Transform->GetMatrix(), p1, p2, t1, t2, clippingPlaneId))
287 {
288 return VTK_DOUBLE_MAX;
289 }
290
291 // Initialize the pick position to the frontmost clipping plane
292 if (this->PickClippingPlanes && clippingPlaneId >= 0)
293 {
294 tMin = t1;
295 }
296
297 // HyperTreeGrid
298 else if ((htgMapper = vtkAbstractHyperTreeGridMapper::SafeDownCast(m)))
299 {
300 tMin = this->IntersectHyperTreeGridWithLine(p1, p2, t1, t2, htgMapper);
301 }
302
303 // Volume
304 else if ((volumeMapper = vtkAbstractVolumeMapper::SafeDownCast(m)))
305 {
306 tMin = this->IntersectVolumeWithLine(p1, p2, t1, t2, prop, volumeMapper);
307 }
308
309 // Image
310 else if ((imageMapper = vtkImageMapper3D::SafeDownCast(m)))
311 {
312 tMin = this->IntersectImageWithLine(p1, p2, t1, t2, prop, imageMapper);
313 }
314
315 // Actor
316 else if ((mapper = vtkMapper::SafeDownCast(m)))
317 {
318 tMin = this->IntersectActorWithLine(p1, p2, t1, t2, tol, prop, mapper);
319 }
320
321 // Unidentified Prop3D
322 else
323 {
324 tMin = this->IntersectProp3DWithLine(p1, p2, t1, t2, tol, prop, m);
325 }
326

Callers 1

Calls 10

NormalizeFunction · 0.50
GetMatrixMethod · 0.45
SetPathMethod · 0.45
TransformPointMethod · 0.45

Tested by

no test coverage detected