Gems/EMotionFX/Code/Tests/SimulatedObjectSetupTests.cpp
int NodeHasCommonParentImpl(const Node* left, const Node* right, const Node* initialLeft, const Node* initialRight)
    {
        if (left == right || (!left && !right))
        {
            return 0;
        }
        if (left == initialRight)
        {
            // right is a parent of left
            return 1;
        }
        if (right == initialLeft)
        {
            // left is a parent of right
            return -1;
        }

        const Node* leftParent = left ? left->GetParentNode() : nullptr;
        const Node* rightParent = right ? right->GetParentNode() : nullptr;
        return NodeHasCommonParentImpl(leftParent, rightParent, initialLeft, initialRight);
    }
// Determine if left is a parent of right, if right is a parent of left, or
// if neither of the two joints are a parent of the other
// Returns: -1 if left is a parent of right,
//          1 if right is a parent of left,
//          0 if neither is a parent of the other
Determine if left is a parent of right, if right is a parent of left, or
if neither of the two joints are a parent of the other
Returns: -1 if left is a parent of right,
1 if right is a parent of left,
0 if neither is a parent of the other
Determine if left is a parent of right if right is a parent of left or if neither of the two joints are a parent of the other Returns : - 1 if left is a parent of right 1 if right is a parent of left 0 if neither is a parent of the other
int NodeHasCommonParentImpl(const Node* left, const Node* right, const Node* initialLeft, const Node* initialRight)
    {
        if (left == right || (!left && !right))
        {
            return 0;
        }
        if (left == initialRight)
        {
            return 1;
        }
        if (right == initialLeft)
        {
            return -1;
        }
        const Node* leftParent = left ? left->GetParentNode() : nullptr;
        const Node* rightParent = right ? right->GetParentNode() : nullptr;
        return NodeHasCommonParentImpl(leftParent, rightParent, initialLeft, initialRight);
    }
int NodeHasCommonParentImpl ( const Node * left , const Node * right , const Node * initialLeft , const Node * initialRight ) { if ( left == right || ( ! left && ! right ) ) { return 0 ; } if ( left == initialRight ) { return 1 ; } if ( right == initialLeft ) { return -1 ; } const Node * leftParent = left ? left -> GetParentNode ( ) : nullptr ; const Node * rightParent = right ? right -> GetParentNode ( ) : nullptr ; return NodeHasCommonParentImpl ( leftParent , rightParent , initialLeft , initialRight ) ; }
Determine if left is a parent of right, if right is a parent of left, or
if neither of the two joints are a parent of the other
Returns: -1 if left is a parent of right,
1 if right is a parent of left,
0 if neither is a parent of the other
Determine if left is a parent of right if right is a parent of left or if neither of the two joints are a parent of the other Returns : - 1 if left is a parent of right 1 if right is a parent of left 0 if neither is a parent of the other
// right is a parent of left // left is a parent of right