Since the iterative algorithm doesn't care about islands of bodies, this is a faster algorithm that just sends it all the joints and bodies in one array. It's downfall is it's inability to handle disabled bodies as well as the old one.
| 850 | // faster algorithm that just sends it all the joints and bodies in one array. |
| 851 | // It's downfall is it's inability to handle disabled bodies as well as the old one. |
| 852 | static void |
| 853 | processIslandsFast (dxWorld * world, dReal stepsize, int maxiterations) |
| 854 | { |
| 855 | // nothing to do if no bodies |
| 856 | if (world->nb <= 0) |
| 857 | return; |
| 858 | |
| 859 | # ifdef TIMING |
| 860 | dTimerStart ("creating joint and body arrays"); |
| 861 | # endif |
| 862 | dxBody **bodies, *body; |
| 863 | dxJoint **joints, *joint; |
| 864 | joints = (dxJoint **) ALLOCA (world->nj * sizeof (dxJoint *)); |
| 865 | bodies = (dxBody **) ALLOCA (world->nb * sizeof (dxBody *)); |
| 866 | |
| 867 | int nj = 0; |
| 868 | for (joint = world->firstjoint; joint; joint = (dxJoint *) joint->next) |
| 869 | joints[nj++] = joint; |
| 870 | |
| 871 | int nb = 0; |
| 872 | for (body = world->firstbody; body; body = (dxBody *) body->next) |
| 873 | { |
| 874 | body->flags &= ~dxBodyDisabled; |
| 875 | bodies[nb++] = body; |
| 876 | |
| 877 | } |
| 878 | |
| 879 | if (nj>3) dInternalStepIslandFast (world, bodies, nb, joints, nj, stepsize, maxiterations); |
| 880 | else dInternalStepIsland (world, bodies, nb, joints, nj, stepsize); |
| 881 | # ifdef TIMING |
| 882 | dTimerEnd (); |
| 883 | dTimerReport (stdout, 1); |
| 884 | # endif |
| 885 | } |
| 886 | |
| 887 | #else |
| 888 |
no test coverage detected