DacWizard/src/main/java/jme3utilities/minie/wizard/Model.java
/**
     * Recalculate the initial Transform for visualization.
     */
Recalculate the initial Transform for visualization.
Recalculate the initial Transform for visualization .
private void recalculateInitTransform() {
        Spatial cgmCopy = Heart.deepCopy(rootSpatial);
        /*
         * Scale the copy uniformly to the desired height, assuming Y-up
         * orientation.
         */
        Vector3f[] minMax = MySpatial.findMinMaxCoords(cgmCopy);
        Vector3f min = minMax[0];
        Vector3f max = minMax[1];
        float oldHeight = max.y - min.y;
        if (oldHeight > 0f) {
            cgmCopy.scale(cgmHeight / oldHeight);
        }
        /*
         * Translate a copy's center so that it rests on the X-Z plane, and its
         * center lies on the Y axis.
         */
        minMax = MySpatial.findMinMaxCoords(cgmCopy);
        min = minMax[0];
        max = minMax[1];
        Vector3f center = MyVector3f.midpoint(min, max, null);
        Vector3f offset = new Vector3f(center.x, min.y, center.z);
        Vector3f location = cgmCopy.getWorldTranslation();
        location.subtractLocal(offset);
        MySpatial.setWorldLocation(cgmCopy, location);
        initTransform.set(cgmCopy.getLocalTransform());
    }
private void recalculateInitTransform ( ) { Spatial cgmCopy = Heart . deepCopy ( rootSpatial ) ; /*
         * Scale the copy uniformly to the desired height, assuming Y-up
         * orientation.
         */ Vector3f [ ] minMax = MySpatial . findMinMaxCoords ( cgmCopy ) ; Vector3f min = minMax [ 0 ] ; Vector3f max = minMax [ 1 ] ; float oldHeight = max . y - min . y ; if ( oldHeight > 0f ) { cgmCopy . scale ( cgmHeight / oldHeight ) ; } /*
         * Translate a copy's center so that it rests on the X-Z plane, and its
         * center lies on the Y axis.
         */ minMax = MySpatial . findMinMaxCoords ( cgmCopy ) ; min = minMax [ 0 ] ; max = minMax [ 1 ] ; Vector3f center = MyVector3f . midpoint ( min , max , null ) ; Vector3f offset = new Vector3f ( center . x , min . y , center . z ) ; Vector3f location = cgmCopy . getWorldTranslation ( ) ; location . subtractLocal ( offset ) ; MySpatial . setWorldLocation ( cgmCopy , location ) ; initTransform . set ( cgmCopy . getLocalTransform ( ) ) ; }
Recalculate the initial Transform for visualization.
Recalculate the initial Transform for visualization .