Skip to content

Commit

Permalink
Use absolute values in axis when computing composite scale factor to …
Browse files Browse the repository at this point in the history
…avoid -ve scale factors depending on translation axis specification (#3992)
  • Loading branch information
aymanhab authored Jan 28, 2025
1 parent bcbfa95 commit 13b5cc1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion OpenSim/Simulation/SimbodyEngine/SpatialTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ void SpatialTransform::scale(const SimTK::Vec3 scaleFactors)
}
SimTK::Vec3 axis;
transform.getAxis(axis);
double scaleFactor = ~axis * scaleFactors;
// we want weighted aggregate of scale factors but to ignore the sign
// ignoring sign due to issue #3991 resulting -ve scale factor
double scaleFactor = ~axis.abs() * scaleFactors;
// If the function is already a MultiplierFunction, just update its scale factor.
// Otherwise, make a MultiplierFunction from it and make the transform axis use
// the new MultiplierFunction.
Expand Down

0 comments on commit 13b5cc1

Please sign in to comment.