Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix negative scale factor of coordinate function due to spatial transform axis direction #3992

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

aymanhab
Copy link
Member

@aymanhab aymanhab commented Jan 16, 2025

Fixes issue #3991

Brief summary of changes

Use absolute values from transform axis when computing aggregate scale factor to avoid erroneous sign flip

Testing I've completed

Tested model/files from bug report on simtk.org

Looking for feedback on...

CHANGELOG.md (choose one)

  • no need to update because...
  • updated.

This change is Reviewable

…avoid -ve scale factors depending on translation axis specification
@LI-RCNL
Copy link

LI-RCNL commented Jan 19, 2025

Hi Dr. Habib,

Using absolute values from transform axis when computing aggregate scale factor is the most appropriate fix to the issue in my opinion. Thank you very much for taking swift action!

Geng Li
Rice Computational Neuromechanics Lab

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a reasonable enough change; but it makes me wonder: is there any scenario where we would want to preserve the sign on the scale factor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While manual scales can be set to -ve numbers, measurement-based scale factors are ratios between (unsigned) distances so can't be -ve. If we think about it as how much we stretch/shrink segments then this should never be -ve otherwise vectors/directions flip which is unlikely an intended behavior of our 'scaling'. However if you suspect there're other places in the code worth more investigation please let me know @nickbianco

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, just making sure I understood this correctly.

Copy link
Member

@nickbianco nickbianco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@aymanhab
Copy link
Member Author

Great, thanks @nickbianco 👍

@aymanhab aymanhab merged commit 13b5cc1 into main Jan 28, 2025
12 checks passed
@aymanhab aymanhab deleted the fix_scalingspatialtransform branch January 28, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants