Skip to content

Commit 13b5cc1

Browse files
authored
Use absolute values in axis when computing composite scale factor to avoid -ve scale factors depending on translation axis specification (#3992)
1 parent bcbfa95 commit 13b5cc1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

OpenSim/Simulation/SimbodyEngine/SpatialTransform.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ void SpatialTransform::scale(const SimTK::Vec3 scaleFactors)
193193
}
194194
SimTK::Vec3 axis;
195195
transform.getAxis(axis);
196-
double scaleFactor = ~axis * scaleFactors;
196+
// we want weighted aggregate of scale factors but to ignore the sign
197+
// ignoring sign due to issue #3991 resulting -ve scale factor
198+
double scaleFactor = ~axis.abs() * scaleFactors;
197199
// If the function is already a MultiplierFunction, just update its scale factor.
198200
// Otherwise, make a MultiplierFunction from it and make the transform axis use
199201
// the new MultiplierFunction.

0 commit comments

Comments
 (0)