opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
758 stars 308 forks source link

Array.rfindIndex is broken #3743

Closed aymanhab closed 2 months ago

aymanhab commented 3 months ago

This was reported as a GUI issue https://github.com/opensim-org/opensim-gui/issues/1496 Stepping through the code it showed that Array.rfindIndex is returning incorrect index/different from legacy version. While the GUI was changed to workaround this (by using findIndex which should yield same answer if there're no duplicates as is the case here though probably more expensive?), however the function needs to be fixed for potential clients or removed and documented as a possible breaking change on the opensim-core side.

aymanhab commented 3 months ago

@adamkewley while not blocking now I'm thinking this slipped through the cracks along with PR #3678 I tested rfindIndex at the scripting shell and it returned an index past the end. Not urgent but good to fix before the next release.

adamkewley commented 3 months ago

Ah crap, sorry about this @aymanhab - it looks like the original algorithm operated a little bit differently from how I would've figured!

I'll have a look into fixing it