I am doing animation with opengl and I have 2 vectors. 1 is an int vector of Bone IDs and 1 is a float vector of weight values. For example, bone_ids[1] corresponds to weight_values[1] or whatever the index is. What I need to do is get the top 3 greatest floats from the weight_values vector but I also need to rearrange the bone_ids array in the exact same way. So if weight_values[1] is moved to weight_values[0] because it is the highest number, I need to move bone_ids[1] to bone_ids[0] as well. An example might be:
int bone_ids = { 1, 2, 2, 3, 2, 0, 1};
int weight_values = { 0.4162, 0.0213, 0.6213, 0.71, 0.09232, 0.5, 0 };
I can easily do this with std::sort and then std::reverse with the weight values and the just grab the first 3 values however I could not find a way to also reorganize the same way with the bone_ids since the bone ids just need to follow the same moves as the weight values.
I only need to grab the top 3 weight values and their top 3 weight ids if that helps. My idea was to just sort the array from highest to lowest and then grab the top 3 weights but I realized I need the bone_ids too and it wouldn't work with that.