(self, joints_to_remove)
| 22 | return self._children |
| 23 | |
| 24 | def remove_joints(self, joints_to_remove): |
| 25 | valid_joints = [] |
| 26 | for joint in range(len(self._parents)): |
| 27 | if joint not in joints_to_remove: |
| 28 | valid_joints.append(joint) |
| 29 | |
| 30 | for i in range(len(self._parents)): |
| 31 | while self._parents[i] in joints_to_remove: |
| 32 | self._parents[i] = self._parents[self._parents[i]] |
| 33 | |
| 34 | index_offsets = np.zeros(len(self._parents), dtype=int) |
| 35 | new_parents = [] |
| 36 | for i, parent in enumerate(self._parents): |
| 37 | if i not in joints_to_remove: |
| 38 | new_parents.append(parent - index_offsets[parent]) |
| 39 | else: |
| 40 | index_offsets[i:] += 1 |
| 41 | self._parents = np.array(new_parents) |
| 42 | |
| 43 | if self._joints_left is not None: |
| 44 | new_joints_left = [] |
| 45 | for joint in self._joints_left: |
| 46 | if joint in valid_joints: |
| 47 | new_joints_left.append(joint - index_offsets[joint]) |
| 48 | self._joints_left = new_joints_left |
| 49 | if self._joints_right is not None: |
| 50 | new_joints_right = [] |
| 51 | for joint in self._joints_right: |
| 52 | if joint in valid_joints: |
| 53 | new_joints_right.append(joint - index_offsets[joint]) |
| 54 | self._joints_right = new_joints_right |
| 55 | |
| 56 | self._compute_metadata() |
| 57 | |
| 58 | return valid_joints |
| 59 | |
| 60 | def joints_left(self): |
| 61 | return self._joints_left |
no test coverage detected