import AST.Start;
import com.jme.bounding.*;
import com.jme.math.*;
import java.io.*;


public class Demo extends Parser {
    public static void main(String args[]){
        Start ast = parse(args);
        Console con = System.console();
        Vector3f vec;
        
        BoundingBox aabb = ast.aabb();
        System.out.println();
        System.out.println("AxisAligned BoundingBox");
        vec = aabb.getCenter();
        System.out.println("Center: X="+vec.getX()+" Y="+vec.getY()+
                           " Z="+vec.getZ());
        vec = aabb.getExtent(null);
        System.out.println("Extent: X="+vec.getX()+" Y="+vec.getY()+
                           " Z="+vec.getZ());
        System.out.println("Volume: "+aabb.getVolume());

        OrientedBoundingBox obb = ast.obb();
        System.out.println("\nOriented BoundingBox");
        vec = obb.getCenter();
        System.out.println("Center: X="+vec.getX()+" Y="+vec.getY()+
                           " Z="+vec.getZ());
        vec = obb.getExtent();
        System.out.println("Extent: X="+vec.getX()+" Y="+vec.getY()+
                           " Z="+vec.getZ());
        System.out.println("Volume: "+obb.getVolume());

        System.out.println();
        String s = new String();
        try {
            ast.prettyPrint("  ",new PrintStream("x3d_demo.x3d"));
            System.out.println("Generated X3D original model");
            s = con.readLine("%s","Press enter to include OBB wire-frame");
            System.out.println();
            ast.addWireFrameBB(obb);
            ast.prettyPrint("  ",new PrintStream("x3d_demo.x3d"));
            s = con.readLine("%s","Press enter to include AABB wire-frame");
            System.out.println();
            ast.addWireFrameBB(aabb);
            ast.prettyPrint("  ",new PrintStream("x3d_demo.x3d"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }
}