public JUMIBone[] getDescendants() { ArrayList<JUMIBone> allBones = new ArrayList(); addDescendantsToList(allBones); JUMIBone[] result = new JUMIBone[allBones.size()]; allBones.toArray(result); return result; }
public JUMIBone[] getFullSkeleton() { ArrayList<JUMIBone> allBones = new ArrayList(); JUMIBone root = getRoot(); allBones.add(root); root.addDescendantsToList(allBones); JUMIBone[] result = new JUMIBone[allBones.size()]; allBones.toArray(result); return result; }
private void addDescendantsToList(ArrayList<JUMIBone> boneList) { for (JUMIBone a : children) { boneList.add(a); a.addDescendantsToList(boneList); } }