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

Method DetermineRenderAxes

Rendering/Annotation/vtkCubeAxesActor.cxx:1484–1575  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Determine which of the axes in each coordinate direction actually should be rendered. For STATIC FlyMode, all axes are rendered. For other FlyModes, either 1 or 2 per coordinate direction are rendered.

Source from the content-addressed store, hash-verified

1482// be rendered. For STATIC FlyMode, all axes are rendered. For other
1483// FlyModes, either 1 or 2 per coordinate direction are rendered.
1484void vtkCubeAxesActor::DetermineRenderAxes(vtkViewport* viewport)
1485{
1486 double bounds[6];
1487 double pts[8][3];
1488 int i = 0, closestIdx = -1, furtherstIdx = -1;
1489 int xloc = 0, yloc = 0, zloc = 0;
1490
1491 // Make sure we start with only one axis by default, then we might extend it
1492 this->NumberOfAxesX = this->NumberOfAxesY = this->NumberOfAxesZ = 1;
1493
1494 // Compute relevant axis points only if a axis/grid visibility change based
1495 // on the viewpoint
1496 if (!(this->GridLineLocation == VTK_GRID_LINES_ALL &&
1497 (this->FlyMode == VTK_FLY_STATIC_EDGES || this->FlyMode == VTK_FLY_STATIC_TRIAD)))
1498 {
1499 // determine the bounds to use (input, prop, or user-defined)
1500 this->GetBounds(bounds);
1501 this->TransformBounds(viewport, bounds, pts);
1502 }
1503
1504 // Check closest point if needed
1505 if (this->GridLineLocation == VTK_GRID_LINES_CLOSEST || this->FlyMode == VTK_FLY_CLOSEST_TRIAD)
1506 {
1507 closestIdx = this->FindClosestAxisIndex(pts);
1508 }
1509
1510 // Check furthest point if needed
1511 if (this->GridLineLocation == VTK_GRID_LINES_FURTHEST || this->FlyMode == VTK_FLY_FURTHEST_TRIAD)
1512 {
1513 furtherstIdx = this->FindFurtherstAxisIndex(pts);
1514 }
1515
1516 // Manage fast static axis visibility
1517 if (this->FlyMode == VTK_FLY_STATIC_EDGES || this->FlyMode == VTK_FLY_STATIC_TRIAD)
1518 {
1519 if (this->FlyMode == VTK_FLY_STATIC_EDGES)
1520 {
1521 this->NumberOfAxesX = this->NumberOfAxesY = this->NumberOfAxesZ = NUMBER_OF_ALIGNED_AXIS;
1522 }
1523
1524 for (i = 0; i < this->NumberOfAxesX; i++)
1525 {
1526 this->RenderAxesX[i] = this->RenderAxesY[i] = this->RenderAxesZ[i] = i;
1527 }
1528
1529 this->UpdateGridLineVisibility(
1530 (this->GridLineLocation == VTK_GRID_LINES_CLOSEST) ? closestIdx : furtherstIdx);
1531 return;
1532 }
1533
1534 // Take into account the inertia. Process only so often.
1535 if (this->RenderCount == 0 || !((this->RenderCount + 1) % this->Inertia))
1536 {
1537 if (this->FlyMode == VTK_FLY_CLOSEST_TRIAD)
1538 {
1539 xloc = vtkCubeAxesActorTriads[closestIdx][0];
1540 yloc = vtkCubeAxesActorTriads[closestIdx][1];
1541 zloc = vtkCubeAxesActorTriads[closestIdx][2];

Callers 1

RenderGeometryMethod · 0.95

Calls 6

TransformBoundsMethod · 0.95
FindClosestAxisIndexMethod · 0.95
FindBoundaryEdgeMethod · 0.95
GetBoundsMethod · 0.45

Tested by

no test coverage detected