Search in sources :

Example 1 with TweedFrame

use of org.twak.tweed.TweedFrame in project chordatlas by twak.

the class SkelFootprintConsole method main.

public static void main(String[] args) {
    System.out.println("solving: first arg: input state. second arg: output state");
    System.out.println("reconstruction: first arg: input state. outputs as obj. can be given a folder of blocks");
    File f = new File(args[0]);
    if (!f.exists()) {
        System.out.println(args[0] + " not found");
        return;
    }
    if (args.length >= 2) {
        System.out.println("running solver");
        long runTime = Long.MAX_VALUE;
        if (args.length >= 3) {
            runTime = Long.parseLong(args[2]);
            System.out.println("for " + runTime + " seconds");
        }
        new SkelFootprintConsole().go((SolverState) new XStream().fromXML(f), new File(args[1]), runTime);
    } else if (args.length == 1) {
        // File f = new File (args[0]);
        ObjDump obj = new ObjDump();
        TweedFrame.HEADLESS = true;
        TweedFrame tf = new TweedFrame();
        SkelGen gen = new SkelGen(tf.tweed);
        File out;
        if (f.exists() && f.isDirectory()) {
            out = new File("combined.obj");
            for (File b : f.listFiles()) dump(gen, new File(b, "done.xml"), obj);
        } else {
            out = new File(args[0] + ".obj");
            dump(gen, new File(args[1]), obj);
        }
        obj.dump(out);
        tf.tweed.destroy();
        System.exit(0);
    } else {
        System.out.println("takes 1 or 2 arguments");
        return;
    }
}
Also used : TweedFrame(org.twak.tweed.TweedFrame) XStream(com.thoughtworks.xstream.XStream) ObjDump(org.twak.utils.geom.ObjDump) SkelGen(org.twak.tweed.gen.skel.SkelGen) File(java.io.File)

Aggregations

XStream (com.thoughtworks.xstream.XStream)1 File (java.io.File)1 TweedFrame (org.twak.tweed.TweedFrame)1 SkelGen (org.twak.tweed.gen.skel.SkelGen)1 ObjDump (org.twak.utils.geom.ObjDump)1