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

Method TestDistanceVisibility

Rendering/Annotation/vtkAxisFollower.cxx:391–427  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

389
390//------------------------------------------------------------------------------
391int vtkAxisFollower::TestDistanceVisibility()
392{
393 if (!this->Camera->GetParallelProjection())
394 {
395 double cameraClippingRange[2];
396
397 this->Camera->GetClippingRange(cameraClippingRange);
398
399 // We are considering the far clip plane for evaluation. In certain
400 // odd conditions it might not work.
401 const double maxVisibleDistanceFromCamera =
402 this->DistanceLODThreshold * (cameraClippingRange[1]);
403
404 double dist =
405 sqrt(vtkMath::Distance2BetweenPoints(this->Camera->GetPosition(), this->Position));
406
407 if (dist > maxVisibleDistanceFromCamera)
408 {
409 // Need to make sure we are not looking at a flat axis and therefore should enable it anyway
410 if (this->Axis)
411 {
412 vtkBoundingBox bbox(this->Axis->GetBounds());
413 return (bbox.GetDiagonalLength() > (cameraClippingRange[1] - cameraClippingRange[0])) ? 1
414 : 0;
415 }
416 return 0;
417 }
418 else
419 {
420 return 1;
421 }
422 }
423 else
424 {
425 return 1;
426 }
427}
428
429//------------------------------------------------------------------------------
430void vtkAxisFollower::ExecuteViewAngleVisibility(double normal[3])

Callers 1

RenderMethod · 0.95

Calls 4

sqrtFunction · 0.50
GetPositionMethod · 0.45
GetBoundsMethod · 0.45
GetDiagonalLengthMethod · 0.45

Tested by

no test coverage detected