Scale object with Transform Object plugin#330
Conversation
| scaleMode_ = ( modifier == GLFW_MOD_CONTROL ); | ||
|
|
There was a problem hiding this comment.
this should be controlled from plugin, not from widget
|
|
||
| const auto scale = ( newScaling - prevScaling_ ) + Vector3f::diagonal( 1 ); | ||
| auto addXf = xf * AffineXf3f::xfAround( Matrix3f::scale( scale ), center_ ) * xf.inverse(); | ||
| addXf_( addXf ); |
There was a problem hiding this comment.
do not apply scale xf to widget
| } | ||
|
|
||
| bool ObjectTransformWidget::onMouseDown_( Viewer::MouseButton button, int ) | ||
| bool ObjectTransformWidget::onMouseDown_( Viewer::MouseButton button, int modifier ) |
|
|
||
| // Changes controls xf (controls will affect object in basis of new xf) | ||
| // note that rotation is applied around 0 coordinate in world space, so use xfAround to process rotation around user defined center | ||
| void setControlsXf( const AffineXf3f& xf ); |
There was a problem hiding this comment.
public methods with hidden implementation should have MRVIEWER_API
| void decomposeQR( const Matrix3f& m, Matrix3f& q, Matrix3f& r ) | ||
| { | ||
| Eigen::HouseholderQR<Eigen::MatrixXf> qr( toEigen( m ) ); | ||
| q = fromEigen( Eigen::Matrix3f{ qr.householderQ() } ); | ||
| r = fromEigen( Eigen::Matrix3f{ qr.matrixQR() } ); | ||
| r.y.x = r.z.x = r.z.y = 0; | ||
| } | ||
|
|
||
| void decomposePositiveQR( const Matrix3f& m, Matrix3f& q, Matrix3f& r ) | ||
| { | ||
| decomposeQR( m, q, r ); | ||
| Matrix3f sign; | ||
| for ( int i = 0; i < 3; ++i ) | ||
| { | ||
| if ( r[i][i] < 0 ) | ||
| sign[i][i] = -1; | ||
| } | ||
| q = q * sign; | ||
| r = sign * r; | ||
| } |
There was a problem hiding this comment.
we have same funcitons in ImGuiMenu, mb make separate functoin like extractScale( AffineXf3f& xf ) to separate scale from rigid transform somewhere in MRMesh project?
Grantim
left a comment
There was a problem hiding this comment.
Also can you reset thresholdDot in create or reset function (https://github.com/MeshInspector/MeshInspectorCode/issues/872)
| template <typename T> | ||
| void decomposeXf( const AffineXf3<T>& xf, Matrix3<T>& rotation, Matrix3<T>& scaling ) |
There was a problem hiding this comment.
please add comment this function
| SceneRoot::get().addChild( activeLine_ ); | ||
| controlsRoot_->setXf( worldXf ); | ||
| setControlsXf( worldXf ); | ||
|
|
There was a problem hiding this comment.
please set default mode (Translation) in create or mb better reset function
|
|
||
| AxisTransformMode axisTransformMode_{ Translation }; | ||
|
|
||
| float sumScale_; |
| bool picked_{ false }; | ||
| bool pickThrough_{ false }; | ||
|
|
||
| std::function<void( float )> scaleTooltipCallback_; |
There was a problem hiding this comment.
i think we need to reset it in create or reset function (like other callbacks)
| enum AxisTransformMode | ||
| { | ||
| Translation, | ||
| Scaling, | ||
| }; | ||
| AxisTransformMode getAxisTransformMode() const { return axisTransformMode_; }; | ||
| void setAxisTransformMode( AxisTransformMode mode ) { axisTransformMode_ = mode; }; |
There was a problem hiding this comment.
please add commets about this structure and how scale works
No description provided.