MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / updateSizeInPixel

Method updateSizeInPixel

source/MRViewer/MRObjectTransformWidget.cpp:657–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655}
656
657void TransformControls::updateSizeInPixel()
658{
659 if ( params_.sizeType != VisualParams::SizeType::Pixels )
660 return;
661
662 if ( !translateControls_[0] )
663 return;
664
665 auto parent = translateControls_[0]->parent();
666 if ( !parent )
667 return;
668
669 auto mask = getViewerInstance().getPresentViewports();
670 for ( auto idViewport : mask )
671 {
672 const auto& xf = parent->worldXf(idViewport);
673 const auto& center = xf( getCenter() );
674 float lenPerPixel = getViewerInstance().viewport( idViewport ).getPixelSizeAtPoint( center );
675
676 AffineXf3f pixelTransform;
677
678 auto radius = params_.radius * lenPerPixel ;
679 pixelTransform = AffineXf3f::xfAround( Matrix3f::scale( radius ), getCenter() );
680
681 for ( int i = int( Axis::X ); i < int( Axis::Count ); ++i )
682 {
683 translateControls_[i]->setXf( pixelTransform, idViewport );
684 rotateControls_[i]->setXf( pixelTransform, idViewport );
685 }
686 }
687}
688
689void TransformControls::resetSizeInPixel_()
690{

Callers 1

preDraw_Method · 0.80

Calls 5

worldXfMethod · 0.80
getPixelSizeAtPointMethod · 0.80
scaleFunction · 0.70
parentMethod · 0.45
setXfMethod · 0.45

Tested by

no test coverage detected