[Bprocessor-commit] model/src/net/sourceforge/bprocessor/model Project.java, 1.171, 1.172 Container
Status: Pre-Alpha
Brought to you by:
henryml
From: Michael L. <he...@us...> - 2009-05-15 11:19:12
|
Update of /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv32318/src/net/sourceforge/bprocessor/model Modified Files: Project.java Container.java Log Message: Fixed tesselation Index: Container.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Container.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Container.java 12 May 2009 12:19:05 -0000 1.24 --- Container.java 15 May 2009 11:17:48 -0000 1.25 *************** *** 52,55 **** --- 52,82 ---- protected long nextConstructorId; + /** + * + * @param surfaces list of surfaces to export + * @param out PrintStream to export to + */ + public static void export(List<Surface> surfaces, PrintStream out) { + List<Edge> edges = new LinkedList(Surface.edges(surfaces)); + List<Vertex> vertices = new LinkedList(Edge.vertices(edges)); + + HashMap<Vertex, Integer> vmap = new HashMap(); + int count = 1; + for (Vertex current : vertices) { + vmap.put(current, count++); + out.println("v " + current.getX() + + " " + current.getY() + " " + current.getZ()); + } + for (Surface current : surfaces) { + List<Vertex> verts = current.getVertices(); + out.print("f"); + for (Vertex v : verts) { + int i = vmap.get(v); + out.print(" " + i); + } + out.println(); + } + } + /** *************** *** 1552,1569 **** } } - - List<Surface> unreachable = new LinkedList(); - for (Surface current : envelope) { - if (!mark.contains(current)) { - unreachable.add(current); - } - } } /** * ! * @param out PrintStream */ ! public void exportTesselated(PrintStream out) { Tesselator tesselator = Project.getInstance().getTesselator(); Container holder = --- 1579,1590 ---- } } } + /** * ! * @return Container */ ! public Container tesselate() { Tesselator tesselator = Project.getInstance().getTesselator(); Container holder = *************** *** 1596,1600 **** } interior.orient(interior.getEnvelope().iterator().next()); ! interior.export(out); //getOwner().add(holder); //Project.getInstance().changed(Project.getInstance()); --- 1617,1630 ---- } interior.orient(interior.getEnvelope().iterator().next()); ! return holder; ! } ! ! /** ! * ! * @param out PrintStream ! */ ! public void exportTesselated(PrintStream out) { ! Container tesselation = tesselate(); ! tesselation.export(out); //getOwner().add(holder); //Project.getInstance().changed(Project.getInstance()); *************** *** 1606,1629 **** */ public void export(PrintStream out) { ! List<Surface> surfaces = new LinkedList(getEnvelope()); ! List<Edge> edges = new LinkedList(Surface.edges(surfaces)); ! List<Vertex> vertices = new LinkedList(Edge.vertices(edges)); ! ! HashMap<Vertex, Integer> vmap = new HashMap(); ! int count = 1; ! for (Vertex current : vertices) { ! vmap.put(current, count++); ! out.println("v " + current.getX() + ! " " + current.getY() + " " + current.getZ()); ! } ! for (Surface current : surfaces) { ! List<Vertex> verts = current.getVertices(); ! out.print("f"); ! for (Vertex v : verts) { ! int i = vmap.get(v); ! out.print(" " + i); ! } ! out.println(); ! } } } --- 1636,1641 ---- */ public void export(PrintStream out) { ! List<Surface> surfaces = new LinkedList(getSurfaces()); ! export(surfaces, out); } } Index: Project.java =================================================================== RCS file: /cvsroot/bprocessor/model/src/net/sourceforge/bprocessor/model/Project.java,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** Project.java 15 May 2009 10:18:12 -0000 1.171 --- Project.java 15 May 2009 11:17:48 -0000 1.172 *************** *** 1601,1608 **** } } for (Container current : constructs) { System.out.println("-- " + current.getName() + " --"); ! current.exportTesselated(printer); } } --- 1601,1611 ---- } } + List<Surface> surfaces = new LinkedList(); for (Container current : constructs) { System.out.println("-- " + current.getName() + " --"); ! Container tesselation = current.tesselate(); ! surfaces.addAll(tesselation.getSurfaces()); } + Container.export(surfaces, printer); } |