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

Method PlaceWidget

Rendering/VR/vtkVRPanelRepresentation.cxx:419–442  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

417
418//------------------------------------------------------------------------------
419void vtkVRPanelRepresentation::PlaceWidget(double bds[6])
420{
421 this->TextActor->GetUserMatrix()->Identity();
422 if (this->CoordinateSystem == World)
423 {
424 // center the planel
425 this->TextActor->SetPosition(
426 0.5 * (bds[0] + bds[1]), 0.5 * (bds[2] + bds[3]), 0.5 * (bds[4] + bds[5]));
427
428 double length = sqrt((bds[1] - bds[0]) * (bds[1] - bds[0]) +
429 (bds[3] - bds[2]) * (bds[3] - bds[2]) + (bds[5] - bds[4]) * (bds[5] - bds[4]));
430 this->TextActor->SetScale(length / 700.0, length / 700.0, length / 700.0);
431 this->LastScale = length;
432 }
433
434 if (this->CoordinateSystem != World)
435 {
436 double scale = sqrt((bds[1] - bds[0]) * (bds[1] - bds[0]) +
437 (bds[3] - bds[2]) * (bds[3] - bds[2]) + (bds[5] - bds[4]) * (bds[5] - bds[4]));
438 this->TextActor->SetScale(scale / 700.0, scale / 700.0, scale / 700.0);
439 this->LastScale = scale;
440 this->TextActor->SetPosition(0.0, 0.0, -0.5 * scale);
441 }
442}
443
444void vtkVRPanelRepresentation::PlaceWidgetExtended(
445 const double* bds, const double* normal, const double* upvec, double scale)

Calls 5

GetUserMatrixMethod · 0.80
sqrtFunction · 0.50
IdentityMethod · 0.45
SetPositionMethod · 0.45
SetScaleMethod · 0.45