private void createCatmullRomMesh(int nbSubSegments) {
        float[] array = new float[((spline.getControlPoints().size() - 1) * nbSubSegments + 1) * 3];
        short[] indices = new short[(spline.getControlPoints().size() - 1) * nbSubSegments * 2];
        int i = 0;
        int cptCP = 0;
        for (Iterator<Vector3f> it = spline.getControlPoints().iterator(); it.hasNext();) {
            Vector3f vector3f = it.next();
            array[i] = vector3f.x;
            i++;
            array[i] = vector3f.y;
            i++;
            array[i] = vector3f.z;
            i++;
            if (it.hasNext()) {
                for (int j = 1; j < nbSubSegments; j++) {
                    spline.interpolate((float) j / nbSubSegments, cptCP, temp);
                    array[i] = temp.getX();
                    i++;
                    array[i] = temp.getY();
                    i++;
                    array[i] = temp.getZ();
                    i++;
                }
            }
            cptCP++;
        }

        i = 0;
        int k;
        for (int j = 0; j < (spline.getControlPoints().size() - 1) * nbSubSegments; j++) {
            k = j;
            indices[i] = (short) k;
            i++;
            k++;
            indices[i] = (short) k;
            i++;
        }

        this.setMode(Mesh.Mode.Lines);
        this.setBuffer(VertexBuffer.Type.Position, 3, array);
        this.setBuffer(VertexBuffer.Type.Index, 2, indices);//(spline.getControlPoints().size() - 1) * nbSubSegments * 2
        this.updateBound();
        this.updateCounts();
    }
Create a curve mesh from a Spline

@param spline the spline to use
@param nbSubSegments the number of subsegments between the control points
jme3-core/src/main/java/com/jme3/scene/shape/Curve.java