CompoundShapeEntry validation suggestion
Posted: Sat Apr 20, 2013 5:27 pm
Hi Norbo,
I recently had a problem that was due to my own error, but to find the cause I wound up adding some more validation to the CompoundShapeEntry which you may want to consider keeping around.
The first type is the validation of the transforms provided to the ctors. Higher level code had been providing invalid transforms to these and I was able to finally trap my bug by adding Validate calls to the inputs that would be used to create the local transforms.
The second type of validation is in the ComputeCenter methods, which currently do not check for a zero weight object. Since the ctors do not verify there is at least one shape in the CompoundShape that has weight, it's possible these methods will divide by zero. Personally, I think it would be most flexible if every shape in the compound isn't required to have mass so long as at least one does. It would probably make sense to consider other places that a weight of zero might cause similar problems.
I've attached my changes in case you want to check them out or use them.
Thanks again for Bepu!
I recently had a problem that was due to my own error, but to find the cause I wound up adding some more validation to the CompoundShapeEntry which you may want to consider keeping around.
The first type is the validation of the transforms provided to the ctors. Higher level code had been providing invalid transforms to these and I was able to finally trap my bug by adding Validate calls to the inputs that would be used to create the local transforms.
The second type of validation is in the ComputeCenter methods, which currently do not check for a zero weight object. Since the ctors do not verify there is at least one shape in the CompoundShape that has weight, it's possible these methods will divide by zero. Personally, I think it would be most flexible if every shape in the compound isn't required to have mass so long as at least one does. It would probably make sense to consider other places that a weight of zero might cause similar problems.
I've attached my changes in case you want to check them out or use them.
Thanks again for Bepu!