MinieExamples/src/main/java/jme3utilities/minie/test/TrackDemo.java
/**
     * Add a 10x10 X-Z square grid to the scene with the specified bottom-left
     * and bottom-right corners, replacing any pre-existing grid.
     */
Add a 10x10 X-Z square grid to the scene with the specified bottom-left
and bottom-right corners, replacing any pre-existing grid.
Add a 10x10 X - Z square grid to the scene with the specified bottom - left and bottom - right corners replacing any pre - existing grid .
private void addGrid() {
        assert gridBottomLeft.x == gridBottomRight.x;
        assert gridBottomLeft.y == gridBottomRight.y;
        assert gridBottomLeft.z < gridBottomRight.z;
        Spatial old = MySpatial.findChild(rootNode, "grid");
        if (old != null) {
            old.removeFromParent();
        }
        int numColumns = 10;
        int numRows = 10;
        float gridSpacing = (gridBottomRight.z - gridBottomLeft.z) / numColumns;
        Mesh mesh = new Grid(numColumns + 1, numRows + 1, gridSpacing);
        Geometry geometry = new Geometry("grid", mesh);
        rootNode.attachChild(geometry);
        geometry.rotate(0f, 0f, FastMath.HALF_PI);
        ColorRGBA gridColor = new ColorRGBA(0f, 0f, 0f, 1f);
        Material mat = MyAsset.createWireframeMaterial(assetManager, gridColor);
        geometry.setMaterial(mat);
        /*
         * Translate the origin of the grid, which
         * becomes its bottom-left corner.
         */
        geometry.move(gridBottomLeft);
        float gridX = gridBottomLeft.x;
        float topY = gridBottomLeft.y + gridSpacing * numRows;
        gridTopLeft = new Vector3f(gridX, topY, gridBottomLeft.z);
        gridTopRight = new Vector3f(gridX, topY, gridBottomRight.z);
    }
private void addGrid ( ) { assert gridBottomLeft . x == gridBottomRight . x ; assert gridBottomLeft . y == gridBottomRight . y ; assert gridBottomLeft . z < gridBottomRight . z ; Spatial old = MySpatial . findChild ( rootNode , "grid" ) ; if ( old != null ) { old . removeFromParent ( ) ; } int numColumns = 10 ; int numRows = 10 ; float gridSpacing = ( gridBottomRight . z - gridBottomLeft . z ) / numColumns ; Mesh mesh = new Grid ( numColumns + 1 , numRows + 1 , gridSpacing ) ; Geometry geometry = new Geometry ( "grid" , mesh ) ; rootNode . attachChild ( geometry ) ; geometry . rotate ( 0f , 0f , FastMath . HALF_PI ) ; ColorRGBA gridColor = new ColorRGBA ( 0f , 0f , 0f , 1f ) ; Material mat = MyAsset . createWireframeMaterial ( assetManager , gridColor ) ; geometry . setMaterial ( mat ) ; /*
         * Translate the origin of the grid, which
         * becomes its bottom-left corner.
         */ geometry . move ( gridBottomLeft ) ; float gridX = gridBottomLeft . x ; float topY = gridBottomLeft . y + gridSpacing * numRows ; gridTopLeft = new Vector3f ( gridX , topY , gridBottomLeft . z ) ; gridTopRight = new Vector3f ( gridX , topY , gridBottomRight . z ) ; }
Add a 10x10 X-Z square grid to the scene with the specified bottom-left
 and bottom-right corners, replacing any pre-existing grid.
Add a 10x10 X - Z square grid to the scene with the specified bottom - left and bottom - right corners replacing any pre - existing grid .