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

Method updateRotation

source/MRViewer/MRObjectTransformWidget.cpp:835–867  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

833}
834
835void TransformControls::updateRotation( Axis ax, const AffineXf3f& xf, float startAngle, float endAngle, ViewportId vpId )
836{
837 std::vector<Vector3f> activePoints;
838 activePoints.reserve( 182 );
839 activePoints.resize( 0 );
840 endAngle = startAngle - ( endAngle - startAngle );
841 int step = 1;
842 if ( ( endAngle - startAngle ) < 0.0f )
843 step = -1;
844
845 auto radius = ( rotateControls_[int( ax )]->xf( vpId ).A * ( rotateLines_[0]->polyline()->points.vec_[0] - getCenter() ) ).length();
846 Vector3f basisXTransfomed = xf.A * baseAxis[( int( ax ) + 1 ) % 3];
847 Vector3f basisYTransfomed = xf.A * baseAxis[( int( ax ) + 2 ) % 3];
848
849 auto centerTransformed = xf( getCenter() );
850
851 activePoints.push_back( centerTransformed +
852 std::cos( startAngle ) * radius * basisXTransfomed +
853 std::sin( startAngle ) * radius * basisYTransfomed );
854
855 if ( std::abs( ( endAngle - startAngle ) * 180 / PI_F ) > 1 )
856 for ( int curAng = int( startAngle * 180 / PI_F + step ); curAng != int( ( endAngle ) * 180 / PI_F ); curAng += step )
857 {
858 activePoints.push_back( centerTransformed +
859 std::cos( float( curAng ) * PI_F / 180 ) * radius * basisXTransfomed +
860 std::sin( float( curAng ) * PI_F / 180 ) * radius * basisYTransfomed );
861 }
862 activePoints.push_back( centerTransformed +
863 std::cos( endAngle ) * radius * basisXTransfomed +
864 std::sin( endAngle ) * radius * basisYTransfomed );
865
866 setActiveLineFromPoints_( activePoints );
867}
868
869TransformModesValidator TransformControls::ThresholdDotValidator( float thresholdDot )
870{

Callers 1

processRotation_Method · 0.80

Calls 6

absFunction · 0.85
push_backMethod · 0.80
reserveMethod · 0.45
resizeMethod · 0.45
lengthMethod · 0.45
xfMethod · 0.45

Tested by

no test coverage detected