MinieLibrary/src/main/java/jme3utilities/minie/PhysicsDumper.java
/**
     * Dump the indices of all nodes in the specified cluster.
     *
     * @param softBody the soft body to dump (not null, unaffected)
     * @param clusterIndex which cluster (&ge;0, &lt;numClusters)
     */
Dump the indices of all nodes in the specified cluster.

@param softBody the soft body to dump (not null, unaffected)
@param clusterIndex which cluster (≥0, <numClusters)
Dump the indices of all nodes in the specified cluster . @param softBody the soft body to dump ( not null unaffected ) @param clusterIndex which cluster ( ≥0 <numClusters )
private void dumpNodesInCluster(PhysicsSoftBody softBody,
            int clusterIndex) {
        IntBuffer nodeIndices = softBody.listNodesInCluster(clusterIndex, null);
        int numIndices = nodeIndices.capacity();
        int numNodesInBody = softBody.countNodes();
        if (numIndices == numNodesInBody) {
            stream.print("(all)");
            return;
        }
        /*
         * convert the IntBuffer to a BitSet
         */
        BitSet bitSet = new BitSet(numNodesInBody);
        for (int i = 0; i < numIndices; ++i) {
            int nodeIndex = nodeIndices.get(i);
            bitSet.set(nodeIndex);
        }
        stream.print('(');
        boolean addSeparators = false;
        for (int nodeIndex = 0; nodeIndex < numNodesInBody; ++nodeIndex) {
            if (bitSet.get(nodeIndex)) {
                if (addSeparators) {
                    stream.print(',');
                } else {
                    addSeparators = true;
                }
                int runLength = bitSet.nextClearBit(nodeIndex) - nodeIndex;
                if (runLength < 3) {
                    stream.printf("%d", nodeIndex);
                } else {
                    int endIndex = nodeIndex + runLength - 1;
                    stream.printf("%d-%d", nodeIndex, endIndex);
                    nodeIndex = endIndex;
                }
            }
        }
        stream.print(')');
    }
private void dumpNodesInCluster ( PhysicsSoftBody softBody , int clusterIndex ) { IntBuffer nodeIndices = softBody . listNodesInCluster ( clusterIndex , null ) ; int numIndices = nodeIndices . capacity ( ) ; int numNodesInBody = softBody . countNodes ( ) ; if ( numIndices == numNodesInBody ) { stream . print ( "(all)" ) ; return ; } /*
         * convert the IntBuffer to a BitSet
         */ BitSet bitSet = new BitSet ( numNodesInBody ) ; for ( int i = 0 ; i < numIndices ; ++ i ) { int nodeIndex = nodeIndices . get ( i ) ; bitSet . set ( nodeIndex ) ; } stream . print ( '(' ) ; boolean addSeparators = false ; for ( int nodeIndex = 0 ; nodeIndex < numNodesInBody ; ++ nodeIndex ) { if ( bitSet . get ( nodeIndex ) ) { if ( addSeparators ) { stream . print ( ',' ) ; } else { addSeparators = true ; } int runLength = bitSet . nextClearBit ( nodeIndex ) - nodeIndex ; if ( runLength < 3 ) { stream . printf ( "%d" , nodeIndex ) ; } else { int endIndex = nodeIndex + runLength - 1 ; stream . printf ( "%d-%d" , nodeIndex , endIndex ) ; nodeIndex = endIndex ; } } } stream . print ( ')' ) ; }
Dump the indices of all nodes in the specified cluster.
Dump the indices of all nodes in the specified cluster .